-
About glReadPixel & double buffering
Hi guy,
in my codes:
------------
glBeing()
...
elEnd()
glutswapbuffer()
glBeing()
...
elEnd()
glutswapbuffer()
glBeing()
...
elEnd()
glutswapbuffer()
glReadpixel(xxx)
--------------------------
after 3 x glutswapbuffer(), I found that the framebuffer i got via glreadpixel is not the same as shown on the screen
What is the reason?
Should I point to the front buffer or the back buffer?
In fact, I just want to get the content which shown on the current screen.
Thanks.
-
Senior Member
OpenGL Guru
Re: About glReadPixel & double buffering
Put glReadBuffer(GL_FRONT) once before the glReadPixels and you read what you see.
In double buffered contexts the glDrawBuffer and the glReadBuffer are both defaulting to GL_BACK.
Some tips:
After a SwapBuffers don't assume the backbuffer contents to be still valid. There is a hint in the dwFlags of the PIXELFORMATDESCRIPTOR which says if the format copies or can swap, those are named PFD_SWAP_COPY and PFD_SWAP_EXCHANGE.
Don't assume pixels overlapped by other windows or moved off the desktop to give useful data on readback. Those fail the pixelownership test and are mostly bogus.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules