I am using OpenGL ES 2.0 and GLSL to draw objects. Then I want to read pixel from whatever my fragment shader draws on my screen. I am blending two grayscale textures and at the end of my fragment shader, I have:
gl_FragColor = vec4(something...blending textures);
I know that gl_FragColor means the final color will be written in the frame buffer. (According to http://nehe.gamedev.net/article/glsl_an_introduction/25007/) Given that, I did something like
GLubyte *pixels = new GLubyte[320*240];
glReadPixels(0, 0, 320,240, GL_LUMINANCE, GL_UNSIGNED_BYTE, pixels);
After drawing image using that, at the first, I get same as the original texture1 and then get the black empty color. Can someone help me what's wrong? Do I need to do something with FBO? I am a kinda lost...:(