Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> |
2 | <!-- saved from url=(0013)about:internet --> | |
3 | <?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>glXMakeCurrent</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glXMakeCurrent"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glXMakeCurrent — attach a GLX context to a window or a GLX pixmap</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">Bool <b class="fsfunc">glXMakeCurrent</b>(</code></td><td>Display * </td><td><var class="pdparam">dpy</var>, </td></tr><tr><td> </td><td>GLXDrawable </td><td><var class="pdparam">drawable</var>, </td></tr><tr><td> </td><td>GLXContext </td><td><var class="pdparam">ctx</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>dpy</code></em></span></dt><dd><p> | |
4 | Specifies the connection to the X server. | |
5 | </p></dd><dt><span class="term"><em class="parameter"><code>drawable</code></em></span></dt><dd><p> | |
6 | Specifies a GLX drawable. | |
7 | Must be either an X window ID or a GLX pixmap ID. | |
8 | </p></dd><dt><span class="term"><em class="parameter"><code>ctx</code></em></span></dt><dd><p> | |
9 | Specifies a GLX rendering context that is to be attached to <em class="parameter"><code>drawable</code></em>. | |
10 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
11 | <code class="function">glXMakeCurrent</code> does two things: | |
12 | It makes <em class="parameter"><code>ctx</code></em> the current GLX rendering context of the calling thread, | |
13 | replacing the previously current context if there was one, | |
14 | and it attaches <em class="parameter"><code>ctx</code></em> to a GLX drawable, | |
15 | either a window or a GLX pixmap. | |
16 | As a result of these two actions, | |
17 | subsequent GL rendering calls | |
18 | use rendering context <em class="parameter"><code>ctx</code></em> to modify GLX drawable <em class="parameter"><code>drawable</code></em> (for | |
19 | reading and writing). | |
20 | Because <code class="function">glXMakeCurrent</code> always replaces the current rendering context with <em class="parameter"><code>ctx</code></em>, | |
21 | there can be only one current context per thread. | |
22 | </p><p> | |
23 | Pending commands to the | |
24 | previous context, if any, are flushed before it is released. | |
25 | </p><p> | |
26 | The first time <em class="parameter"><code>ctx</code></em> is made current to any thread, | |
27 | its viewport is set to the full size of <em class="parameter"><code>drawable</code></em>. | |
28 | Subsequent calls by any thread to <code class="function">glXMakeCurrent</code> with <em class="parameter"><code>ctx</code></em> | |
29 | have no effect on its viewport. | |
30 | </p><p> | |
31 | To release the current context without assigning a new one, | |
32 | call <code class="function">glXMakeCurrent</code> with <em class="parameter"><code>drawable</code></em> set to <code class="constant">None</code> and <em class="parameter"><code>ctx</code></em> | |
33 | set to <code class="constant">NULL</code>. | |
34 | </p><p> | |
35 | <code class="function">glXMakeCurrent</code> returns <code class="constant">True</code> if it is successful, | |
36 | <code class="constant">False</code> otherwise. | |
37 | If <code class="constant">False</code> is returned, the previously current rendering context | |
38 | and drawable (if any) remain unchanged. | |
39 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p> | |
40 | A <span class="emphasis"><em>process</em></span> is a single-execution environment, | |
41 | implemented in a single address space, | |
42 | consisting of one or more threads. | |
43 | </p><p> | |
44 | A <span class="emphasis"><em>thread</em></span> is one of a set of subprocesses that share | |
45 | a single address space, | |
46 | but maintain separate program counters, | |
47 | stack spaces, | |
48 | and other related global data. | |
49 | A <span class="emphasis"><em>thread</em></span> that is the only member of its subprocess group | |
50 | is equivalent to a <span class="emphasis"><em>process</em></span>. | |
51 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p> | |
52 | <code class="constant">BadMatch</code> is generated if <em class="parameter"><code>drawable</code></em> was not | |
53 | created with the same X screen and visual as <em class="parameter"><code>ctx</code></em>. | |
54 | It is also generated if <em class="parameter"><code>drawable</code></em> is <code class="constant">None</code> and <em class="parameter"><code>ctx</code></em> is not | |
55 | <code class="constant">NULL</code>. | |
56 | </p><p> | |
57 | <code class="constant">BadAccess</code> is generated if <em class="parameter"><code>ctx</code></em> was current to another thread | |
58 | at the time <code class="function">glXMakeCurrent</code> was called. | |
59 | </p><p> | |
60 | <code class="constant">GLXBadDrawable</code> is generated if <em class="parameter"><code>drawable</code></em> is not a valid GLX drawable. | |
61 | </p><p> | |
62 | <code class="constant">GLXBadContext</code> is generated if <em class="parameter"><code>ctx</code></em> is not a valid GLX context. | |
63 | </p><p> | |
64 | <code class="constant">GLXBadContextState</code> is generated if <code class="function">glXMakeCurrent</code> is executed between | |
65 | the execution of <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> and the corresponding execution of <a class="citerefentry" href="glEnd.xml"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>. | |
66 | </p><p> | |
67 | <code class="constant">GLXBadContextState</code> is also generated if the rendering context current | |
68 | to the calling thread has GL renderer state <code class="constant">GLX_FEEDBACK</code> or | |
69 | <code class="constant">GLX_SELECT</code>. | |
70 | </p><p> | |
71 | <code class="constant">GLXBadCurrentWindow</code> is generated if there are pending GL | |
72 | commands for the previous context and the current drawable is | |
73 | a window that is no longer valid. | |
74 | </p><p> | |
75 | <code class="constant">BadAlloc</code> may be generated if the server has delayed allocation | |
76 | of ancillary buffers until <code class="function">glXMakeCurrent</code> is called, only to find that it has | |
77 | insufficient resources to complete the allocation. | |
78 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
79 | <a class="citerefentry" href="glXCreateContext.xml"><span class="citerefentry"><span class="refentrytitle">glXCreateContext</span></span></a>, | |
80 | <a class="citerefentry" href="glXCreateGLXPixmap.xml"><span class="citerefentry"><span class="refentrytitle">glXCreateGLXPixmap</span></span></a> | |
81 | <a class="citerefentry" href="glXGetCurrentContext.xml"><span class="citerefentry"><span class="refentrytitle">glXGetCurrentContext</span></span></a>, | |
82 | <a class="citerefentry" href="glXGetCurrentDisplay.xml"><span class="citerefentry"><span class="refentrytitle">glXGetCurrentDisplay</span></span></a>, | |
83 | <a class="citerefentry" href="glXGetCurrentDrawable.xml"><span class="citerefentry"><span class="refentrytitle">glXGetCurrentDrawable</span></span></a>, | |
84 | <a class="citerefentry" href="glXGetCurrentReadDrawable.xml"><span class="citerefentry"><span class="refentrytitle">glXGetCurrentReadDrawable</span></span></a>, | |
85 | <a class="citerefentry" href="glXMakeContextCurrent.xml"><span class="citerefentry"><span class="refentrytitle">glXMakeContextCurrent</span></span></a> | |
86 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
87 | Copyright <span class="trademark"></span>© 1991-2006 | |
88 | Silicon Graphics, Inc. This document is licensed under the SGI | |
89 | Free Software B License. For details, see | |
90 | <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. | |
91 | </p></div></div></body></html> |