- March 11, 2013 at 2:10 pm #31181
I’ve got an application that renders the color and depth buffers to textures via a frame buffer object using OpenGL ES 2.0. Using the PC Emulator everything works fine, but when I try to run the application on the actual hardware (PowerVR SGX540), the color texture is valid, but the depth texture appears to be all black. I don’t appear to be getting any OpenGL or driver errors, but it appears that no data is being written to the depth texture. I’m using GL_DEPTH_COMPONENT for the depth texture format and GL_UNSIGNED_SHORT for the type.
Is there any reason this configuration wouldn’t work on the SGX540? Does anyone know of anything I need to look out for in trying to make this work?March 11, 2013 at 9:23 pm #36828
Please disregard, I figured it out. Oddly enough, it was the depth texture wrapping mode. Changing this from GL_REPEAT to GL_CLAMP_TO_EDGE fixed the problem. Go figure.March 12, 2013 at 10:02 am #36829
The reason for this is that non-power-of-two textures are only partially supported in OpenGL ES and the emulator is not currently imitating the hardware correctly. Specifically, a black texture should be produced for NPOT textures if:
– GL_TEXTURE_MIN_FILTER is set to anything other than GL_NEAREST or GL_LINEAR
– The repeat mode is set to anything other than GL_CLAMP_TO_EDGE
If you’d like to use a wrapping texture then the dimensions of your texture should be powers of two.