View Full Version : glReadPixels after the shader?

11-14-2011, 11:03 PM
I am working on opengl ES 2 with GLSL shading language and I have a problem using glReadPixels.
So through my vertex then fragment shader, I compute something and then subtract texture or etc and then output it.I know that through gl_FragColor, it will be written to frame buffer as well. After it, I did something like

GLubyte *pixels = new GLubyte[320*240];
glReadPixels(0, 0, 320,240, GL_LUMINANCE, GL_UNSIGNED_BYTE, pixels);
Then I made it to jpg file to see what's going on, why my images keep changing? I mean it seems like it gets original texture (not the one I output gl_FragColor) then later, all black. My textures are already setup as GL_LUMINANCE (grayscale). Can someone help me how to access pixel data (like unsigned char*) after gl_FragColor?

11-19-2011, 10:24 AM
GL_LUMINANCE is not an allowed format in GLES for glReadPixels.