SetEnvmapped gives a flickering texture

Started by take2316, March 06, 2013, 05:44:28 AM

Previous topic - Next topic

take2316

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
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?

take2316

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:

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?

EgonOlsen

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.