Home

glXMakeCurrent

glXMakeCurrent is a function in the GLX API used on the X Window System to bind an OpenGL rendering context to a drawable for the calling thread. By making a context current, subsequent OpenGL commands issued by that thread render into the specified drawable (window or pixmap).

Signature: GLboolean glXMakeCurrent(Display* dpy, GLXDrawable drawable, GLXContext ctx);

It returns GL_TRUE on success and GL_FALSE on failure. If ctx is non-NULL, the specified context becomes

Notes: glXMakeCurrent operates on a per-thread basis; different threads may have different current contexts. To detach

current
for
the
calling
thread
for
drawing
to
the
given
drawable.
If
ctx
is
NULL,
the
current
context
for
the
thread
is
released.
The
drawable
must
be
a
valid
GLXDrawable
associated
with
dpy,
and
the
context
must
be
compatible
with
the
drawable’s
visual
and
the
display.
The
call
can
fail
if
the
display
is
not
open,
the
context
is
not
compatible
with
the
drawable,
or
the
context
has
not
been
created
for
that
display.
a
context,
you
can
call
glXMakeCurrent(dpy,
None,
NULL).
After
rendering,
the
frame
is
typically
presented
with
glXSwapBuffers.
For
environments
that
support
separate
read
and
draw
contexts,
GLX
1.3
provides
glXMakeContextCurrent
to
bind
both
read
and
draw
contexts
to
a
thread.
Related
functions
include
glXCreateContext,
glXDestroyContext,
and
glXGetCurrentContext.