NAME

glXSwapBuffers - exchange front and back buffers

C SPECIFICATION

void ggllXXSSwwaappBBuuffffeerrss( Display _*_d_p_y,
                     GLXDrawable _d_r_a_w_a_b_l_e )

delim $$

PARAMETERS

_d_p_y
Specifies the connection to the X server.
_d_r_a_w_a_b_l_e
Specifies the drawable whose buffers are to be swapped.

DESCRIPTION

ggllXXSSwwaappBBuuffffeerrss promotes the contents of the back buffer of _d_r_a_w_a_b_l_e to become the contents of the front buffer of _d_r_a_w_a_b_l_e. The contents of the back buffer then become undefined. The update typically takes place during the vertical retrace of the monitor, rather than immediately after ggllXXSSwwaappBBuuffffeerrss is called.

ggllXXSSwwaappBBuuffffeerrss performs an implicit ggllFFlluusshh before it returns. Subsequent OpenGL commands may be issued immediately after calling ggllXXSSwwaappBBuuffffeerrss, but are not executed until the buffer exchange is completed.

If _d_r_a_w_a_b_l_e was not created with respect to a double-buffered visual, ggllXXSSwwaappBBuuffffeerrss has no effect, and no error is generated.

NOTES

The contents of the back buffer become undefined after a swap. Note that this applies to pbuffers as well as windows.

All GLX rendering contexts share the same notion of which are front buffers and which are back buffers. One consequence is that when multiple clients are rendering to the same double-buffered window, all of them should finish rendering before one of them issues the command to swap buffers. The clients are responsible for implementing this synchronization. Typically this is accomplished by executing ggllFFiinniisshh and then using a semaphore in shared memory to rendezvous before swapping.

ERRORS

GGLLXXBBaaddDDrraawwaabbllee is generated if _d_r_a_w_a_b_l_e is not a valid GLX drawable.

GGLLXXBBaaddCCuurrrreennttWWiinnddooww is generated if _d_p_y and _d_r_a_w_a_b_l_e are respectively the display and drawable associated with the current context of the calling thread, and _d_r_a_w_a_b_l_e identifies a window that is no longer valid.

SEE ALSO

ggllFFlluusshh, ggllXXBBiinnddSSwwaappBBaarrrriieerrSSGGIIXX, ggllXXJJooiinnSSwwaappGGrroouuppSSGGIIXX, ggllXXSSwwaappIInntteerrvvaallSSGGII