PDA

View Full Version : OpenGL buffer operation?



alpha1
07-05-2003, 10:42 AM
How can i copy date between buffers, when you use double buffers?
I just want use glbegin and glend once, and copy what i drew to buffer. After that, every time programme calls display function, it won't redraw it again. You can swap and copy or copy and swap. So one of these buffers always hold the image which should be display.

jwatte
07-05-2003, 11:51 AM
The contents of the back buffer is undefined after you've swapped buffers.

You can use glReadPixels() before swap, and then glDrawPixels() again later. However, this is not likely to be fast.

You can copy data into a texture using glCopyTexSubImage().

You can use the KTX_buffer_region extension, which does more or less what you want, except it's kind-of poorly specified and not consistently implemented.

Relic
07-06-2003, 11:35 PM
You can use glCopyPixels to copy data between buffers, too.

BUT, think of the backbuffer to be clipped like the front buffer. You must not assume pixels overlapped by other windows to be defined in the backbuffer.
For a working backing storage solution use a pbuffer for fully unclipped rendering and restore from there.

The ARB_buffer_region extension is also available in case the ill defined KTX_buffer_region extension doesn't fit your needs.
Mind the things said about clipping and undefined pixel contents apply here, too.

abaybas
07-08-2003, 01:12 PM
I'm using wgl_arb_buffer_region to do extactly that. It's pretty simple to use if you know how to use extensions. I can send you some source code if you want.

alpha1
07-08-2003, 08:57 PM
I'm not really sure about extensions. would you give me some detail? and source code is good as well.