EZ
Up Prev Next Contents


5.4.2 Choosing a Back Buffer

Be default, the library is in single buffer mode. Whatever you draw is displayed immediately on the screen. If you want to do some animations, single buffer will not be adequate because you'll see the screen clear as well as all the drawing. During animation, you'll see a visible flickering. For such situation, it is preferable to draw a frame in a hidden back buffer and copy the completed buffer to the display (the front buffer) when done.

Buffering is controled by three items: A back buffer, an attribute to signal which buffer to draw into, and a command to copy the back buffer to the front buffer.

The following routines select a back buffer.

void EZ_SetBackBuffer(int type)

This function chooses a back buffer for the current graphics context. EZwgl supports two types of back buffers, an EZ_PIXMAP back buffer and an EZ_XIMAGE back buffer. The latter is usually faster on localhost. On a remote host, however, the former is usually faster since it needs less data transfer via the network.

Warning: The EZ_XIMAGE backbuffer does not support the standard X11 bitmap fonts and logical pixle operations. The default back buffer is EZ_PIXMAP.

EZwgl also provides a function to select the back buffer automatically.

void EZ_AutoSelectBackBuffer(void)

This function selects a back buffer based on the environment variable EZ_BACK_BUFFER, which can be either pixmap or ximage. If this environment variable is not set, then it makes a selection based on the following creterion: if the server supports shared memory extension and it is usable, then it selects the EZ_XIMAGE back buffer; otherwise, it selects the EZ_PIXMAP back buffer.

To signal which buffer to draw, use

void EZ_DrawBuffer(int buf)

Use the next function to copy the contents of a back buffer to the front.

void EZ_SwapBuffers(void)


HTML Documentation Maintainance:Arturo Espinosa <arturo@nuclecu.unam.mx>