NAME

glXMakeCurrent - attach a GLX context to a window or a GLX pixmap

C SPECIFICATION

Bool ggllXXMMaakkeeCCuurrrreenntt( Display _*_d_p_y,
                     GLXDrawable _d_r_a_w_a_b_l_e,
                     GLXContext _c_t_x )

delim $$

PARAMETERS

_d_p_y
Specifies the connection to the X server.
_d_r_a_w_a_b_l_e
Specifies a GLX drawable. Must be either an X window ID or a GLX pixmap ID.
_c_t_x
Specifies a GLX rendering context that is to be attached to _d_r_a_w_a_b_l_e.

DESCRIPTION

ggllXXMMaakkeeCCuurrrreenntt does two things: It makes _c_t_x the current GLX rendering context of the calling thread, replacing the previously current context if there was one, and it attaches _c_t_x to a GLX drawable, either a window or a GLX pixmap. As a result of these two actions, subsequent GL rendering calls use rendering context _c_t_x to modify GLX drawable _d_r_a_w_a_b_l_e. Because ggllXXMMaakkeeCCuurrrreenntt always replaces the current rendering context with _c_t_x, there can be only one current context per thread.

Pending commands to the previous context, if any, are flushed before it is released.

The first time _c_t_x is made current to any thread, its viewport is set to the full size of _d_r_a_w_a_b_l_e. Subsequent calls by any thread to ggllXXMMaakkeeCCuurrrreenntt with _c_t_x have no effect on its viewport.

To release the current context without assigning a new one, call ggllXXMMaakkeeCCuurrrreenntt with _d_r_a_w_a_b_l_e set NNoonnee and _c_t_x set to NNUULLLL

ggllXXMMaakkeeCCuurrrreenntt returns TTrruuee if it is successful, FFaallssee otherwise. If FFaallssee is returned, the previously current rendering context and drawable (if any) remain unchanged.

NOTES

A _p_r_o_c_e_s_s is a single-execution environment, implemented in a single address space, consisting of one or more threads.

A _t_h_r_e_a_d is one of a set of subprocesses that share a single address space, but maintain separate program counters, stack spaces, and other related global data. A _t_h_r_e_a_d that is the only member of its subprocess group is equivalent to a _p_r_o_c_e_s_s.

ERRORS

BBaaddMMaattcchh is generated if _d_r_a_w_a_b_l_e was not created with the same X screen and visual as _c_t_x. It is also generated if _d_r_a_w_a_b_l_e is NNoonnee and _c_t_x is not NNUULLLL.

BBaaddAAcccceessss is generated if _c_t_x was current to another thread at the time ggllXXMMaakkeeCCuurrrreenntt was called.

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

GGLLXXBBaaddCCoonntteexxtt is generated if _c_t_x is not a valid GLX context.

GGLLXXBBaaddCCoonntteexxttSSttaattee is generated if ggllXXMMaakkeeCCuurrrreenntt is executed between the execution of ggllBBeeggiinn and the corresponding execution of ggllEEnndd.

GGLLXXBBaaddCCoonntteexxttSSttaattee is also generated if the rendering context current to the calling thread has GL renderer state GGLL__FFEEEEDDBBAACCKK or GGLL__SSEELLEECCTT.

GGLLXXBBaaddCCuurrrreennttWWiinnddooww is generated if there are pending GL commands for the previous context and the current drawable is a window that is no longer valid.

BBaaddAAlllloocc may be generated if the server has delayed allocation of ancillary buffers until ggllXXMMaakkeeCCuurrrreenntt is called, only to find that it has insufficient resources to complete the allocation.

SEE ALSO

ggllXXCCrreeaatteeCCoonntteexxtt, ggllXXCCrreeaatteeGGLLXXPPiixxmmaapp