PDA

View Full Version : making swapbuffers only copy



Succinct
12-05-2000, 09:43 AM
anyone know how to make the swapbuffers call only copy the backbuffer to the screen instead of swapping their contents?

i don't draw the whole screen each frame, and i have it rigged so that i dont' have to clear it every frame, either...

everything bounces once it's done animating..

thx in advance if you know
-succinct

Glossifah
12-05-2000, 03:51 PM
I don't know if this is possible. At least not within the definition of the SwapBuffer(hDC); function. The two areas of memory reserved for front and back buffer do not actually get swapped during this call, merely the pointer to which is the designated front buffer is alternated.

There may be a way to draw to the accumulation buffer in a manner which would provide the results you are looking for.

Hmmm...

Glossifah

Succinct
12-05-2000, 05:06 PM
naah, i read some more.. it says that the contents of the backbuffer are undefined after a call to SwapBuffers, and that consecutive calls to SwapBuffers may not produce similar results...

UGGH.

well, looks like i gotta clear each frame...

gotta be something..

at least it works in windowed mode

12-13-2000, 07:27 AM
Actually, if your hardware supports a pixelformat where PFD_SWAP_COPY is true, you can swap the front and back buffers and the back buffer will remain the same. Your hardware must support this though. Try looping through all available pixelformats by calling
maxPixelFormats = DescribePixelFormat(hDC, 0, 0, NULL); (this gives the number of existing pixelformats -- 24 of them are generic and always exist, so if you get maxpixelformats=48, then #1-24 are hardware specific)

Then loop from 1 to maxPixelFormats calling describepixelformat each time and test for the PFD_SWAP_COPY property. If you never get one that's true, you're screwed ... but you can always buy a new video card that supports it. Oxygen vx1 does, but not in stereo.


Originally posted by Succinct:
anyone know how to make the swapbuffers call only copy the backbuffer to the screen instead of swapping their contents?

i don't draw the whole screen each frame, and i have it rigged so that i dont' have to clear it every frame, either...

everything bounces once it's done animating..

thx in advance if you know
-succinct

j
12-13-2000, 08:46 AM
OpenGL has a function to copy a buffer directly into another one.

You could set the source buffer to GL_BACK, the destination buffer to GL_FRONT, and then just call the copy function.

For more information, look in http://heron.cc.ukans.edu/ebt-bin/nph-dweb/dynaweb/SGI_Developer/OpenGL_PG/

Chapter 8 has the stuff you want.

j

j