开发者

Procedure for debugging glReadPixels

So my glReadPixel call:

  glPixelStorei(GL_PACK_ALIGNMENT, 1);
  GLfloat lebuf[128 * 128 * 4];
  glReadPixels(0, 0, 128, 128, GL_RGBA, GL_FLOAT, lebuf);

just puts 1.0 values in the lebuf array. This is just after finishing drawing the page, and the resultant result is a "white" image.

checking the GL errors indicate that there's nothing wrong.

what could have possibly 开发者_开发问答gone wrong?


Make sure glReadBuffer(GL_FRONT) is set before glReadPixels. If it is not, you could be reading from a different buffer, such as the back buffer when double buffering.

And of course, ensure that your capture area - 128x128 - is not all white.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜