www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: take2316 on March 06, 2013, 05:44:28 am

Title: SetEnvmapped gives a flickering texture
Post by: take2316 on March 06, 2013, 05:44:28 am
I'm following the Integrating jPCT-AE with Vuforia code (http://www.jpct.net/wiki/index.php/Integrating_JPCT-AE_with_Vuforia), and want to use environment mapping for the textures. So I added
Code: [Select]
cube.setEnvmapped(Object3D.ENVMAP_ENABLED);but what I get is a flashing (flickering) texture. Could someone point me in the right direction to use environment mapping?
Title: Re: SetEnvmapped gives a flickering texture
Post by: take2316 on March 06, 2013, 07:33:08 am
I tried following the wiki code again, but this time I used OpenGL ES 2.0 (I was using 1.1 before) and it seems like it might be working without flickering. However, I'm unsure if the environment mapping is really working. When I call setEnvmapped, the texture looks exactly the same as when I do not call setEnvmapped. Here's the 3 relevant lines of code:
Code: [Select]
cube.calcTextureWrapSpherical(); // if this line is gone, then the cube is simply black
cube.setTexture("texture");
cube.setEnvmapped(Object3D.ENVMAP_ENABLED); // this line doesn't seem to change the appearance of the texture!

Any ideas on how to check if the environment mapping is working?
Title: Re: SetEnvmapped gives a flickering texture
Post by: EgonOlsen on March 06, 2013, 09:10:39 am
Environment mapping isn't fully supported by jPCT-AE. OpenGL ES doesn't support it, so the 1.1 path tries to mimic it by using a tweaked texture matrix, but as you may have noticed, the results aren't that good. 2.0 ignores the setting. To really use it, you would have to write a shader in 2.0 that does it. ATM i don't have the time to do that, but if somebody comes up with a solution, i would try to integrate it into the engine.