Does Flip swap buffers or just copy backbuffer?

BlitzMax Forums/BlitzMax Beginners Area/Does Flip swap buffers or just copy backbuffer?

ImaginaryHuman(Posted 2004) [#1]
Just wondering, in double-buffered OpenGL (or general BlitzMax) rendering, you draw to the backbuffer usually. When you do a Flip to see the backbuffer, does it:

a) Give the graphics hardware a new pointer to somewhere in video memory so that the previously hidden image shows and is used to draw the image on the physical screen?

b) The backbuffer image is copied, pixel by pixel (more or less) to another buffer (ie front buffer), whereby only the front buffer is actually viewable, and there is never really any swapping going on, just copying from backbuffer to front?

c) Back and front buffers, or reference to them, are both swapped so that the old front buffer becomes the new backbuffer? And if so, does this involve copying all the pixels?

For example, in window mode, how would it double-buffer unless perhaps it has two buffers hidden in videoram and it copies to a portion of a third buffer - the desktop?

I'm just trying to figure what the options are for double buffering and which is faster or more appropriate in given situations, and also whether I could do my own `flip` in a different way. Like maybe I could only ever draw to the backbuffer, and to see it, do a CopyPixels to the front buffer... and just keep doing that all the time - ie the backbuffer is never seen and it isn't swapped, it's just copied?


flying willy(Posted 2004) [#2]
I think it's driver dependent and flips where possible else block transfers.

Using flip is the fastest you can get with smooth graphics. Unless you're thinking of triple buffering but imho triple buffering has never sped things up for me.


ImaginaryHuman(Posted 2004) [#3]
Well, a Flip flips the entire buffer. If a block transfer is invovled, you can speed it up by transferring only part of the full screen that changes, like keeping a control panel contast and just updating the game area.

From what I can tell, at least on a slow iBook G3, with software OpenGL, the actual frame `Flip` is not very quick and can only run around 30fps all by itself, not leaving much time for anything else. So I figure it's copying memory around. I just wanted to see if there's an optimal way to speed it up by doing the `flip` manually, like only copying part of the screen or keeping the same backbuffer all the time.