Imagination PowerVR SDK Blog

how to read alpha in the framebuffer by glReadPixe


#1
hi,

how to read alpha in the framebuffer by glReadPixels?

i try like this, but failed

glReadPixels(0,0,64,64, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, renderbuf);

#2

The only format/type combination that always works with glReadPixels is GL_RGBA/GL_UNSIGNED_BYTE.





There is also one implementation-specified format/type combination which works. To find out what it is you need to query GL_IMPLEMENTATION_COLOR_READ_FORMAT and GL_IMPLEMENTATION_COLOR_READ_TYPE using glGetIntegerv. This format/type may depend on the pixel format of the current read surface, so you need to query it while the surface you want to read from is bound.





If your application requires a fixed format, though, GL_RGBA/GL_UNSIGNED_BYTE is the only safe option.


#3

thank you very much , i have read the alpha using this way