jPCT-AE - a 3d engine for Android > Support

Terrain and GenericVertexController..

<< < (2/5) > >>

EgonOlsen:
Yes, that's correct. The reason is that the geometry will be batched/compiled based on texture states.

LowPolyMan:

--- Quote from: EgonOlsen on March 22, 2013, 02:38:10 pm ---Yes, that's correct. The reason is that the geometry will be batched/compiled based on texture states.

--- End quote ---

Ok, well then the second option is to include the texture and use UV coords. I made a new texture containing a light texture 256x512 and a dark texture 256x512 horizontal left and right.
( i first did it 512x512 and 512x512, the total texture size is 1024x512 and it loaded well :P)

When i want to map the first texture i just do x 0.0 to 0.4999, but i can't seem to get the second one from 0.5 to 1.0. When i try that i just get the whole texture. I tried a lot of things..

UPDATE:

I found reTexture() code on the forum that works well. It takes a variable tileFactor, when i put that to -0.5 it maps the left upper part of the texture and when i put that to 0.5 it maps the low right part. So i created my texture accordingly. This seems to work for me, i know it's a bit unnecessary memory consumption  not using the upper right and lower left part of the texture pixels.

LowPolyMan:

--- Quote from: LowPolyMan on March 23, 2013, 10:07:20 am ---
--- Quote from: EgonOlsen on March 22, 2013, 02:38:10 pm ---Yes, that's correct. The reason is that the geometry will be batched/compiled based on texture states.

--- End quote ---

Ok, well then the second option is to include the texture and use UV coords. I made a new texture containing a light texture 256x512 and a dark texture 256x512 horizontal left and right.
( i first did it 512x512 and 512x512, the total texture size is 1024x512 and it loaded well :P)

When i want to map the first texture i just do x 0.0 to 0.4999, but i can't seem to get the second one from 0.5 to 1.0. When i try that i just get the whole texture. I tried a lot of things..

UPDATE:

I found reTexture() code on the forum that works well. It takes a variable tileFactor, when i put that to -0.5 it maps the left upper part of the texture and when i put that to 0.5 it maps the low right part. So i created my texture accordingly. This seems to work for me, i know it's a bit unnecessary memory consumption  not using the upper right and lower left part of the texture pixels.

--- End quote ---

I've been busy trying to change the UV coords realtime but i can't seem to get it working like it should.

Stange thing is, i have modified the function reTexture to adjust the UV's how i want them. When Objects are not compiled it works great (i can map -0.5 up left OR 0.5 low right of the texture) but when compiled it works but gives strange results (maps the whole texture no up left or down right).  I must do something wrong.

I also have discovered using octree for my heightmap (for toutch events) works but gives  nullpointers using calcMinDistance sometimes.

EgonOlsen:

--- Quote from: LowPolyMan on March 23, 2013, 11:23:57 pm ---Stange thing is, i have modified the function reTexture to adjust the UV's how i want them. When Objects are not compiled it works great (i can map -0.5 up left OR 0.5 low right of the texture) but when compiled it works but gives strange results (maps the whole texture no up left or down right).  I must do something wrong.

--- End quote ---
Make sure to use the proper compile()-call. If you want to change texture coordinates at runtime, you have to use compile(true, false); You might have to call Object3D.touch() after adjusting uv-mapping as well.


--- Quote from: LowPolyMan on March 23, 2013, 11:23:57 pm ---I also have discovered using octree for my heightmap (for toutch events) works but gives  nullpointers using calcMinDistance sometimes.

--- End quote ---
Make sure that you aren't accessing any jPCT related objects in the method that handles the touch events. Set a flag instead and evaluate it in onDrawFrame(). jPCT (and jPCT-AE) aren't thread safe. If the problem persist, please post the exception.

LowPolyMan:

--- Quote from: EgonOlsen on March 23, 2013, 11:45:39 pm ---
--- Quote from: LowPolyMan on March 23, 2013, 11:23:57 pm ---Stange thing is, i have modified the function reTexture to adjust the UV's how i want them. When Objects are not compiled it works great (i can map -0.5 up left OR 0.5 low right of the texture) but when compiled it works but gives strange results (maps the whole texture no up left or down right).  I must do something wrong.

--- End quote ---
Make sure to use the proper compile()-call. If you want to change texture coordinates at runtime, you have to use compile(true, false); You might have to call Object3D.touch() after adjusting uv-mapping as well.


--- Quote from: LowPolyMan on March 23, 2013, 11:23:57 pm ---I also have discovered using octree for my heightmap (for toutch events) works but gives  nullpointers using calcMinDistance sometimes.

--- End quote ---
Make sure that you aren't accessing any jPCT related objects in the method that handles the touch events. Set a flag instead and evaluate it in onDrawFrame(). jPCT (and jPCT-AE) aren't thread safe. If the problem persist, please post the exception.

--- End quote ---

Why don't those idiots read the documents first, i hear you think..  :)

Build also has this boolean i seen, or is staticUV default to false with build?

Anyway, tried it all and doesn't help anything. I can't seem to get it working and i know i'm doing something wrong because the second texture is mapped upside down when object is NOT compiled, but doesn't get mapped at all when it is compiled (i still get the whole texture). I made a a screenshot. I also have some example source if you like.

And i leave octree for now, using default object CollisionMode works fine and the app loads much faster also.

(Ohh, the glitch in the screenshot is my mistake, not JPCT ;)



[attachment deleted by admin]

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version