I'm at a loss as to how to read the pixels from the backbuffer on ATI cards. Any pointers? I've tried everything, but just can't get glReadPixels to return any meaningful data on ATI cards at all. Help!?!?
post your source code. butfor example
glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, frame);
should read data from color framebuffer.
glReadPixels(0, 0, view_width, view_height, GL_DEPTH_COMPONENT, GL_FLOAT, depth_pixels);
glReadPixels(0, 0, view_width, view_height, GL_RGBA, GL_UNSIGNED_BYTE, colours);
Both report no errors, both work on Nvidia and Intel cards. On ATI however all depth values are 1, and all colours are the clear colour. If I set the read buffer to GL_FRONT, then it works. If I set it to the GL_BACK I get *nothing*. I've tried doing this from an FBO as well, and get exactly the same results. This just affects ATI cards and I'm perplexed????
OK, have a workaround. If I render into an FBO, I can then use glCopyTexSubImage2D to copy the region I want to read to an unused mipmap level, and then finally I can I use glGetTexImage to read the pixel data back. Ugh. What a PITA.
which hardware/os are you using ? as well, which pixelformat are you using ?
we have many apps (including thousands of our own tests) using ReadPixels without any issue, so your report is surprising. usually, we can see issues because of pixel ownership (reading a pixel in back/front buffer not owned by the window), but that does not seem your case.
from your description, it could be that nothing got actually rendered in your back buffer. what happens if you do a swapbuffer after your readpixels which failed ?
Are you reading pixels after swapbuffers? I only know of copy and exchange buffer swap modes but it seems possible that the contents of the back buffer are undefined after a swap. The fact that clear values are returned is suspicious, have you tried an explicit glfinish before readpixels?
Retrieving data ...