PDA

View Full Version : Partial swapbuffers?



Adrian67
04-01-2003, 12:31 PM
Hi,
I have a very complex scene drawn and I wish to update just a small part of it. If I redraw everything when I make the change it is going to be too slow. Is it possible to just draw the changes in the backbuffer and then swap just the small area which has the change? (I thought I might be able to do this by setting the scissor region around the changed area and swapping buffers, but I think swapbuffers swaps the entire buffer, ignoring the scissor test.)

Is it reasonable to draw my change to the backbuffer and then do a copypixels (or a read/drawpixels) from the back to the front for just the changed area?

Humus
04-01-2003, 12:49 PM
You can either render to a texture and paste that onto the front buffer, or you can draw the complex scene to a texture and paste it over the framebuffer before rendering each frame. I would probably use the latter method.

Adrian67
04-01-2003, 01:25 PM
I'm not sure a texture would work, as I'm talking about a potentially full-screen display. Do you mean an off-screen buffer?

evanGLizr
04-01-2003, 01:41 PM
Originally posted by Adrian67:
Is it reasonable to draw my change to the backbuffer and then do a copypixels (or a read/drawpixels) from the back to the front for just the changed area?


Some CAD programs do expensive dirty region updates via glCopyPixels or via GL_WIN_SWAP_HINT (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glfunc01_16zy.asp) extension.

You may also find interesting WGL_buffer_region (http://oss.sgi.com/projects/ogl-sample/registry/ARB/wgl_buffer_region.txt) or KTX_buffer_region for saveunder management.

Shinobi
04-01-2003, 11:42 PM
There is a great example of partial Swap Buffer described in "OpenGL SuperBible" if you do have the chance to borrow it do it. There's a sample that uses partial swap buffer for an airplane console. It renders the terrain and copies first 60% of buffer to screen for terrain. The other 40% are updated only if someone changes attitude or something. It uses an common opengl extention which I currently do not know what it is.