glReadPixels after the shader?

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?

GL_LUMINANCE is not an allowed format in GLES for glReadPixels.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.