Imagination PowerVR SDK Blog

about glReadPixels API


#1

I use glReadPixels  to capture my colorbuffer  on symbian s60 3rd, but  only get the first pixel of my framebuffer, and the pixel copy to all other array ,such as code below:

 

unsigned char * imageData;

imageData = new unsigned char[3 * width * height];

glReadPixels(0,0, width, height,GL_RGB,GL_UNSIGNED_BYTE, (unsigned char*)imageData);

 

all the data in imageData are the same as the first pixel of framebuffer, I don't why ??

 

 

and my egl setting as below:

 

EGLConfig<FONT face="Courier

#2
gordongao wrote:
glReadPixels(0,0, width, height,GL_RGB,GL_UNSIGNED_BYTE, (unsigned char*)imageData);

Please check the values of GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES and

GL_IMPLEMENTATION_COLOR_READ_TYPE_OES with glGetIntegerv before using a format/type combination other than GL_RGBA, GL_UNSIGNED_BYTE with glReadPixels. GL_RGBA, GL_UNSIGNED_BYTE is the only combination that is guaranteed to always work.



Have you checked glGetError()?