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>glXMakeContextCurrent</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glXMakeContextCurrent"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glXMakeContextCurrent — attach a GLX context to a GLX drawable</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">glXMakeContextCurrent</b>(</code></td><td>Display * </td><td><var class="pdparam">display</var>, </td></tr><tr><td> </td><td>GLXDrawable </td><td><var class="pdparam">draw</var>, </td></tr><tr><td> </td><td>GLXDrawable </td><td><var class="pdparam">read</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>display</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>draw</code></em></span></dt><dd><p> | |
6 | Specifies a GLX drawable to render into. | |
7 | Must be an XID representing a GLXWindow, GLXPixmap, or GLXPbuffer. | |
8 | </p></dd><dt><span class="term"><em class="parameter"><code>read</code></em></span></dt><dd><p> | |
9 | Specifies a GLX drawable to read from. | |
10 | Must be an XID representing a GLXWindow, GLXPixmap, or GLXPbuffer. | |
11 | </p></dd><dt><span class="term"><em class="parameter"><code>ctx</code></em></span></dt><dd><p> | |
12 | Specifies the GLX context to be bound to <em class="parameter"><code>read</code></em> and <em class="parameter"><code>ctx</code></em>. | |
13 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
14 | <code class="function">glXMakeContextCurrent</code> binds <em class="parameter"><code>ctx</code></em> to the current rendering thread and to the <em class="parameter"><code>draw</code></em> | |
15 | and <em class="parameter"><code>read</code></em> GLX drawables. <em class="parameter"><code>draw</code></em> and <em class="parameter"><code>read</code></em> may be the same. | |
16 | </p><p> | |
17 | <em class="parameter"><code>draw</code></em> is used for all OpenGL operations except: | |
18 | </p><p> | |
19 | Any pixel data that are read based on the value of <code class="constant">GLX_READ_BUFFER</code>. | |
20 | Note that accumulation operations use the value of <code class="constant">GLX_READ_BUFFER</code>, | |
21 | but are not allowed unless <em class="parameter"><code>draw</code></em> is identical to <em class="parameter"><code>read</code></em>. | |
22 | </p><p> | |
23 | Any depth values that are retrieved by <a class="citerefentry" href="glReadPixels.xml"><span class="citerefentry"><span class="refentrytitle">glReadPixels</span></span></a> or <a class="citerefentry" href="glCopyPixels.xml"><span class="citerefentry"><span class="refentrytitle">glCopyPixels</span></span></a>. | |
24 | </p><p> | |
25 | Any stencil values that are retrieved by <a class="citerefentry" href="glReadPixels.xml"><span class="citerefentry"><span class="refentrytitle">glReadPixels</span></span></a> or | |
26 | <a class="citerefentry" href="glCopyPixels.xml"><span class="citerefentry"><span class="refentrytitle">glCopyPixels</span></span></a>. | |
27 | </p><p> | |
28 | Frame buffer values are taken from <em class="parameter"><code>draw</code></em>. | |
29 | </p><p> | |
30 | If the current rendering thread has a current rendering context, that | |
31 | context is flushed and replaced by <em class="parameter"><code>ctx</code></em>. | |
32 | </p><p> | |
33 | The first time that <em class="parameter"><code>ctx</code></em> is made current, the viewport and scissor | |
34 | dimensions are set to the size of the <em class="parameter"><code>draw</code></em> drawable. The viewport | |
35 | and scissor are not modified when <em class="parameter"><code>ctx</code></em> is subsequently made current. | |
36 | </p><p> | |
37 | To release the current context without assigning a new one, | |
38 | call <code class="function">glXMakeContextCurrent</code> with <em class="parameter"><code>draw</code></em> and <em class="parameter"><code>read</code></em> set to <code class="constant">None</code> and <em class="parameter"><code>ctx</code></em> | |
39 | set to <code class="constant">NULL</code>. | |
40 | </p><p> | |
41 | <code class="function">glXMakeContextCurrent</code> returns <code class="constant">True</code> if it is successful, | |
42 | <code class="constant">False</code> otherwise. | |
43 | If <code class="constant">False</code> is returned, the previously current rendering context | |
44 | and drawable (if any) remain unchanged. | |
45 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p> | |
46 | <code class="function">glXMakeContextCurrent</code> is available only if the GLX version is 1.3 or greater. | |
47 | </p><p> | |
48 | If the GLX version is 1.1 or 1.0, the GL version must be 1.0. | |
49 | If the GLX version is 1.2, then the GL version must be 1.1. | |
50 | If the GLX version is 1.3, then the GL version must be 1.2. | |
51 | </p><p> | |
52 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p> | |
53 | <code class="constant">BadMatch</code> is generated if <em class="parameter"><code>draw</code></em> and <em class="parameter"><code>read</code></em> are not compatible. | |
54 | </p><p> | |
55 | <code class="constant">BadAccess</code> is generated if <em class="parameter"><code>ctx</code></em> is current to some other | |
56 | thread. | |
57 | </p><p> | |
58 | <code class="constant">GLXContextState</code> is generated if there is a current rendering | |
59 | context and its render mode is either <code class="constant">GLX_FEEDBACK</code> or | |
60 | <code class="constant">GLX_SELECT</code>. | |
61 | </p><p> | |
62 | <code class="constant">GLXBadContext</code> is generated if <em class="parameter"><code>ctx</code></em> is not a valid GLX | |
63 | rendering context. | |
64 | </p><p> | |
65 | <code class="constant">GLXBadDrawable</code> is generated if <em class="parameter"><code>draw</code></em> or <em class="parameter"><code>read</code></em> is not a valid | |
66 | GLX drawable. | |
67 | </p><p> | |
68 | <code class="constant">GLXBadWindow</code> is generated if the underlying X window for either | |
69 | <em class="parameter"><code>draw</code></em> or <em class="parameter"><code>read</code></em> is no longer valid. | |
70 | </p><p> | |
71 | <code class="constant">GLXBadCurrentDrawable</code> is generated if the previous context of | |
72 | the calling thread has unflushed commands and the previous drawable is | |
73 | no longer valid. | |
74 | </p><p> | |
75 | <code class="constant">BadAlloc</code> is generated if the X server does not have enough | |
76 | resources to allocate the buffers. | |
77 | </p><p> | |
78 | <code class="constant">BadMatch</code> is generated if: | |
79 | </p><p> | |
80 | <em class="parameter"><code>draw</code></em> and <em class="parameter"><code>read</code></em> cannot fit into frame buffer memory simultaneously. | |
81 | </p><p> | |
82 | <em class="parameter"><code>draw</code></em> or <em class="parameter"><code>read</code></em> is a GLXPixmap and <em class="parameter"><code>ctx</code></em> is a direct-rendering | |
83 | context. | |
84 | </p><p> | |
85 | <em class="parameter"><code>draw</code></em> or <em class="parameter"><code>read</code></em> is a GLXPixmap and <em class="parameter"><code>ctx</code></em> was previously bound to a | |
86 | GLXWindow or GLXPbuffer. | |
87 | </p><p> | |
88 | <em class="parameter"><code>draw</code></em> or <em class="parameter"><code>read</code></em> is a GLXWindow or GLXPbuffer and <em class="parameter"><code>ctx</code></em> was | |
89 | previously bound to a GLXPixmap. | |
90 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
91 | <a class="citerefentry" href="glXCreateNewContext.xml"><span class="citerefentry"><span class="refentrytitle">glXCreateNewContext</span></span></a>, | |
92 | <a class="citerefentry" href="glXCreateWindow.xml"><span class="citerefentry"><span class="refentrytitle">glXCreateWindow</span></span></a>, | |
93 | <a class="citerefentry" href="glXCreatePixmap.xml"><span class="citerefentry"><span class="refentrytitle">glXCreatePixmap</span></span></a>, | |
94 | <a class="citerefentry" href="glXCreatePbuffer.xml"><span class="citerefentry"><span class="refentrytitle">glXCreatePbuffer</span></span></a>, | |
95 | <a class="citerefentry" href="glXDestroyContext.xml"><span class="citerefentry"><span class="refentrytitle">glXDestroyContext</span></span></a>, | |
96 | <a class="citerefentry" href="glXGetCurrentContext.xml"><span class="citerefentry"><span class="refentrytitle">glXGetCurrentContext</span></span></a>, | |
97 | <a class="citerefentry" href="glXGetCurrentDisplay.xml"><span class="citerefentry"><span class="refentrytitle">glXGetCurrentDisplay</span></span></a>, | |
98 | <a class="citerefentry" href="glXGetCurrentDrawable.xml"><span class="citerefentry"><span class="refentrytitle">glXGetCurrentDrawable</span></span></a>, | |
99 | <a class="citerefentry" href="glXGetCurrentReadDrawable.xml"><span class="citerefentry"><span class="refentrytitle">glXGetCurrentReadDrawable</span></span></a>, | |
100 | <a class="citerefentry" href="glXMakeCurrent.xml"><span class="citerefentry"><span class="refentrytitle">glXMakeCurrent</span></span></a> | |
101 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
102 | Copyright <span class="trademark"></span>© 1991-2006 | |
103 | Silicon Graphics, Inc. This document is licensed under the SGI | |
104 | Free Software B License. For details, see | |
105 | <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. | |
106 | </p></div></div></body></html> |