1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE book PUBLIC
"-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id=
"glXMakeCurrent">
9 <holder>Silicon Graphics, Inc.
</holder>
12 <refentrytitle>glXMakeCurrent
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>glXMakeCurrent
</refname>
17 <refpurpose>attach a GLX context to a window or a GLX pixmap
</refpurpose>
19 <refsynopsisdiv><title>C Specification
</title>
22 <funcdef>Bool
<function>glXMakeCurrent
</function></funcdef>
23 <paramdef>Display *
<parameter>dpy
</parameter></paramdef>
24 <paramdef>GLXDrawable
<parameter>drawable
</parameter></paramdef>
25 <paramdef>GLXContext
<parameter>ctx
</parameter></paramdef>
29 <!-- eqn: ignoring delim $$ -->
30 <refsect1 id=
"parameters"><title>Parameters
</title>
33 <term><parameter>dpy
</parameter></term>
36 Specifies the connection to the X server.
41 <term><parameter>drawable
</parameter></term>
44 Specifies a GLX drawable.
45 Must be either an X window ID or a GLX pixmap ID.
50 <term><parameter>ctx
</parameter></term>
53 Specifies a GLX rendering context that is to be attached to
<parameter>drawable
</parameter>.
59 <refsect1 id=
"description"><title>Description
</title>
61 <function>glXMakeCurrent
</function> does two things:
62 It makes
<parameter>ctx
</parameter> the current GLX rendering context of the calling thread,
63 replacing the previously current context if there was one,
64 and it attaches
<parameter>ctx
</parameter> to a GLX drawable,
65 either a window or a GLX pixmap.
66 As a result of these two actions,
67 subsequent GL rendering calls
68 use rendering context
<parameter>ctx
</parameter> to modify GLX drawable
<parameter>drawable
</parameter> (for
70 Because
<function>glXMakeCurrent
</function> always replaces the current rendering context with
<parameter>ctx
</parameter>,
71 there can be only one current context per thread.
74 Pending commands to the
75 previous context, if any, are flushed before it is released.
78 The first time
<parameter>ctx
</parameter> is made current to any thread,
79 its viewport is set to the full size of
<parameter>drawable
</parameter>.
80 Subsequent calls by any thread to
<function>glXMakeCurrent
</function> with
<parameter>ctx
</parameter>
81 have no effect on its viewport.
84 To release the current context without assigning a new one,
85 call
<function>glXMakeCurrent
</function> with
<parameter>drawable
</parameter> set to
<constant>None
</constant> and
<parameter>ctx
</parameter>
86 set to
<constant>NULL
</constant>.
89 <function>glXMakeCurrent
</function> returns
<constant>True
</constant> if it is successful,
90 <constant>False
</constant> otherwise.
91 If
<constant>False
</constant> is returned, the previously current rendering context
92 and drawable (if any) remain unchanged.
95 <refsect1 id=
"notes"><title>Notes
</title>
97 A
<emphasis>process
</emphasis> is a single-execution environment,
98 implemented in a single address space,
99 consisting of one or more threads.
102 A
<emphasis>thread
</emphasis> is one of a set of subprocesses that share
103 a single address space,
104 but maintain separate program counters,
106 and other related global data.
107 A
<emphasis>thread
</emphasis> that is the only member of its subprocess group
108 is equivalent to a
<emphasis>process
</emphasis>.
111 <refsect1 id=
"errors"><title>Errors
</title>
113 <constant>BadMatch
</constant> is generated if
<parameter>drawable
</parameter> was not
114 created with the same X screen and visual as
<parameter>ctx
</parameter>.
115 It is also generated if
<parameter>drawable
</parameter> is
<constant>None
</constant> and
<parameter>ctx
</parameter> is not
116 <constant>NULL
</constant>.
119 <constant>BadAccess
</constant> is generated if
<parameter>ctx
</parameter> was current to another thread
120 at the time
<function>glXMakeCurrent
</function> was called.
123 <constant>GLXBadDrawable
</constant> is generated if
<parameter>drawable
</parameter> is not a valid GLX drawable.
126 <constant>GLXBadContext
</constant> is generated if
<parameter>ctx
</parameter> is not a valid GLX context.
129 <constant>GLXBadContextState
</constant> is generated if
<function>glXMakeCurrent
</function> is executed between
130 the execution of
<citerefentry><refentrytitle>glBegin
</refentrytitle></citerefentry> and the corresponding execution of
<citerefentry><refentrytitle>glEnd
</refentrytitle></citerefentry>.
133 <constant>GLXBadContextState
</constant> is also generated if the rendering context current
134 to the calling thread has GL renderer state
<constant>GLX_FEEDBACK
</constant> or
135 <constant>GLX_SELECT
</constant>.
138 <constant>GLXBadCurrentWindow
</constant> is generated if there are pending GL
139 commands for the previous context and the current drawable is
140 a window that is no longer valid.
143 <constant>BadAlloc
</constant> may be generated if the server has delayed allocation
144 of ancillary buffers until
<function>glXMakeCurrent
</function> is called, only to find that it has
145 insufficient resources to complete the allocation.
148 <refsect1 id=
"seealso"><title>See Also
</title>
150 <citerefentry><refentrytitle>glXCreateContext
</refentrytitle></citerefentry>,
151 <citerefentry><refentrytitle>glXCreateGLXPixmap
</refentrytitle></citerefentry>
152 <citerefentry><refentrytitle>glXGetCurrentContext
</refentrytitle></citerefentry>,
153 <citerefentry><refentrytitle>glXGetCurrentDisplay
</refentrytitle></citerefentry>,
154 <citerefentry><refentrytitle>glXGetCurrentDrawable
</refentrytitle></citerefentry>,
155 <citerefentry><refentrytitle>glXGetCurrentReadDrawable
</refentrytitle></citerefentry>,
156 <citerefentry><refentrytitle>glXMakeContextCurrent
</refentrytitle></citerefentry>
159 <refsect1 id=
"Copyright"><title>Copyright
</title>
161 Copyright
<trademark class=
"copyright"></trademark> 1991-
2006
162 Silicon Graphics, Inc. This document is licensed under the SGI
163 Free Software B License. For details, see
164 <ulink url=
"http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/
</ulink>.