Hi there,
i’m getting mad with glReadPixels and i don’t know what i do wrong…
i have a quiet complex program using a lot of 2d-textures with some of them renderd as frambuffers. Now i want to read pixels from some texture and the result i get is always 0.
What i do is currently this:
glBindTexture (GL_TEXTURE_2D, buf->buf_Texture);
int tb, at;
glGetIntegerv (GL_TEXTURE_BINDING_2D, &tb);
glGetIntegerv (GL_ACTIVE_TEXTURE, &at);
Debug (2,"Active: " + tostr(at-GL_TEXTURE0) + ((tb>0) ?" Binding: " + tostr(tb) : ""));
glPixelStorei (GL_PACK_ALIGNMENT, 1) ;
glReadPixels (0,0, buf->buf_W, buf->buf_H, GL_RGB, GL_FLOAT, tArr);
Debug (2,
tostr(tArr[96+0]) + " - " + tostr(tArr[96+1]) + " - " + tostr(tArr[96+2]) + "
"
+ tostr(tArr[96+3]) + " - " + tostr(tArr[96+4]) + " - " + tostr(tArr[96+5]) + "
"
+ tostr(tArr[96+6]) + " - " + tostr(tArr[96+7]) + " - " + tostr(tArr[96+8]) + "
"
+ tostr(tArr[96+9]) + " - " + tostr(tArr[96+10]) + " - " + tostr(tArr[96+11]));
As you can see i have a lot of test-outputs, so i’m sure, the correct texture is bound. The same texture is used otherwhise later, so i’m sure, i’s not empty and there is almost no black pixel inside. But for all the red pixels the result is zero.
Any idea what is wrong??
Thanks for reading,
Frank