flip portion of the gl back buffer?

BlitzMax Forums/OpenGL Module/flip portion of the gl back buffer?

skn3(Posted 2010) [#1]
Is it possible to flip only part of the back buffer with GL?

I have done some googling, and will continue to do so but I havn't found anything yet...

I am using a a canvas in maxgui that the majority of the time is only updating a part of the backbuffer. Every now and then a full redraw of the area will happen, but I was wondering if anyone knows a way to flip a portion of the backbuffer when a full redraw is not needed?

The reason is that when I have the canvas taking up the majority of the screen (1920 x 1200 resolution), it slows down as I assume a lot of wasted buffer/memory copying is going on...


ImaginaryHuman(Posted 2010) [#2]
You can potentially copy a rectangle from the GL_READ buffer to the GL_DRAW buffer if you set those up to point to the backbuffer and the front buffer... but I have found that different os/s and different graphics drivers/cards handle it in different ways, sometimes switching between the two when you flip and sometimes not. But you could try it. e.g. glCopyPixels()?

Note that if you do this without any sync to the vertical blank you will get tearing.


skn3(Posted 2010) [#3]
After reading some stuff on the apple Dev center, it seems that depending on where/how the context has been setup that there are two methods of flipping/flushing the buffers. One being a copy of data and another by just switching the two, so I guess that is similar to the behavior you mention?

For my purposes I have created a layered canvas class in the style of a Photoshop canvas but also versatile to be used to draw lists of items like the layer panel in Photoshop. So tearing here should not be much of an issue. I will have a look into the method you mentioned..