View Full Version : Is glReadPixels affected by loaded textures?

05-11-2015, 01:27 AM

I'm working with an older OpenGL app, using the fixed pipeline. The app uses a cubemap and I'm querying vertex information with:

glReadPixels( x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z );

and then using the newfound z in a call to gluUnproject.

A few days ago, I realized that sometimes the unprojected values are wrong with the textured cube, whereas in a test app without textures it always returns correct values.

I'm wondering if having the textures active when reading the pixel information is affecting the output.

Is a good idea to call
glDisable(GL_TEXTURE_CUBE_MAP) before calling glReadPixels and gluUnproject?

Thanks in advance!