MGL_swapBuffers

Swaps the currently active front and back buffers for a display device context.

Declaration

void MGLAPI MGL_swapBuffers(
MGLDC *dc,
int waitVRT)

Prototype In

mgraph.h

Parameters

dc | Display device context
waitVRT | Wait for retrace flag (MGL_waitVRTFlagType)

Description

This function swaps the currently active front and back buffers. This routine should only be called after the MGL_doubleBuffer has been called to initialize the double buffering for the device context. Once double buffering has been set up, all output from MGL will go to the current offscreen buffer, and the output can be made visible by calling this routine. This routine is the standard technique used to achieve smooth animation.

When the visible display buffer is changed, you should normally allow MGL to sync to the vertical retrace by passing a value of MGL_waitVRT in the waitVRT parameter to ensure that the change occurs in the correct place, and that you don't get flicker effects on the display.

You may however want to turn off the vertical retrace synching if you are synching up with the retrace period using some other means by passing a value of MGL_dontWait to the waitVRT parameter. This is also useful if you are measuring the performance of your application and you want it to run at full speed without without the overhead of waiting for the vertical retrace.

Note: This function only implements double buffering so do not pass a value of MGL_tripleBuffer in the waitVRT parameter. If you need triple buffering support, use the MGL_setActivePage and MGL_setVisual page functions directly to implement this.

See Also

MGL_doubleBuffer, MGL_singleBuffer

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com