• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <title xmlns:xlink="http://www.w3.org/1999/xlink">eglMakeCurrent - EGL Reference Pages</title>
5    <link rel="stylesheet" type="text/css" href="khronos-man.css"/>
6    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1"/>
7  </head>
8  <body>
9    <header/>
10    <div class="refentry" id="eglMakeCurrent">
11      <div class="titlepage"/>
12      <div class="refnamediv">
13        <h2>Name</h2>
14        <p>eglMakeCurrent —
15            attach an EGL rendering context to EGL surfaces
16        </p>
17      </div>
18      <div class="refsynopsisdiv">
19        <h2>C Specification</h2>
20        <div class="funcsynopsis">
21          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
22            <tr>
23              <td>
24                <code class="funcdef">EGLBoolean <strong class="fsfunc">eglMakeCurrent</strong>(</code>
25              </td>
26              <td>EGLDisplay <var class="pdparam">display</var>, </td>
27            </tr>
28            <tr>
29              <td> </td>
30              <td>EGLSurface <var class="pdparam">draw</var>, </td>
31            </tr>
32            <tr>
33              <td> </td>
34              <td>EGLSurface <var class="pdparam">read</var>, </td>
35            </tr>
36            <tr>
37              <td> </td>
38              <td>EGLContext <var class="pdparam">context</var><code>)</code>;</td>
39            </tr>
40          </table>
41          <div class="funcprototype-spacer"> </div>
42        </div>
43      </div>
44      <div class="refsect1" id="parameters">
45        <h2>Parameters</h2>
46        <div class="variablelist">
47          <dl class="variablelist">
48            <dt>
49              <span class="term">
50                <em class="parameter">
51                  <code>display</code>
52                </em>
53              </span>
54            </dt>
55            <dd>
56              <p>Specifies the <abbr class="acronym">EGL</abbr> display connection.</p>
57            </dd>
58            <dt>
59              <span class="term">
60                <em class="parameter">
61                  <code>draw</code>
62                </em>
63              </span>
64            </dt>
65            <dd>
66              <p>Specifies the <abbr class="acronym">EGL</abbr> draw surface.</p>
67            </dd>
68            <dt>
69              <span class="term">
70                <em class="parameter">
71                  <code>read</code>
72                </em>
73              </span>
74            </dt>
75            <dd>
76              <p>Specifies the <abbr class="acronym">EGL</abbr> read surface.</p>
77            </dd>
78            <dt>
79              <span class="term">
80                <em class="parameter">
81                  <code>context</code>
82                </em>
83              </span>
84            </dt>
85            <dd>
86              <p>Specifies the <abbr class="acronym">EGL</abbr> rendering context
87                        to be attached to the surfaces.
88                    </p>
89            </dd>
90          </dl>
91        </div>
92      </div>
93      <div class="refsect1" id="description">
94        <h2>Description</h2>
95        <p>
96            <code class="function">eglMakeCurrent</code> binds <em class="parameter"><code>context</code></em>
97            to the current rendering thread and to the <em class="parameter"><code>draw</code></em>
98            and <em class="parameter"><code>read</code></em> surfaces. <em class="parameter"><code>draw</code></em>
99            is used for all GL operations except for any pixel data read back
100            (<a class="citerefentry" href="glReadPixels.xhtml"><span class="citerefentry"><span class="refentrytitle">glReadPixels</span></span></a>,
101            <a class="citerefentry" href="glCopyTexImage2D.xhtml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage2D</span></span></a>, and
102            <a class="citerefentry" href="glCopyTexSubImage2D.xhtml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage2D</span></span></a>),
103            which is taken from the frame buffer values of
104            <em class="parameter"><code>read</code></em>.
105        </p>
106        <p>
107            If the calling thread has already a current rendering context, that
108            context is flushed and marked as no longer current.
109        </p>
110        <p>
111            The first time that <em class="parameter"><code>context</code></em> is made current,
112            the viewport and scissor dimensions are set to the size of the
113            <em class="parameter"><code>draw</code></em> surface. The viewport and
114            scissor are not modified when <em class="parameter"><code>context</code></em> is
115            subsequently made current.
116        </p>
117        <p>
118            To release the current context without assigning a new one, call
119            <code class="function">eglMakeCurrent</code> with <em class="parameter"><code>draw</code></em>
120            and <em class="parameter"><code>read</code></em> set to
121            <code class="constant">EGL_NO_SURFACE</code> and <em class="parameter"><code>context</code></em>
122            set to <code class="constant">EGL_NO_CONTEXT</code>.
123        </p>
124        <p>
125            Use
126            <a class="citerefentry" href="eglGetCurrentContext.xhtml"><span class="citerefentry"><span class="refentrytitle">eglGetCurrentContext</span></span></a>,
127            <a class="citerefentry" href="eglGetCurrentDisplay.xhtml"><span class="citerefentry"><span class="refentrytitle">eglGetCurrentDisplay</span></span></a>, and
128            <a class="citerefentry" href="eglGetCurrentSurface.xhtml"><span class="citerefentry"><span class="refentrytitle">eglGetCurrentSurface</span></span></a>
129            to query the current rendering context and associated display connection and surfaces.
130        </p>
131      </div>
132      <div class="refsect1" id="errors">
133        <h2>Errors</h2>
134        <p>
135            <code class="constant">EGL_FALSE</code> is returned on failure,
136            <code class="constant">EGL_TRUE</code> otherwise. If <code class="constant">EGL_FALSE</code>
137            is returned, the previously current rendering context and
138            surfaces (if any) remain unchanged.
139        </p>
140        <p>
141            <code class="constant">EGL_BAD_DISPLAY</code> is generated if
142            <em class="parameter"><code>display</code></em> is not an EGL display connection.
143        </p>
144        <p>
145            <code class="constant">EGL_NOT_INITIALIZED</code> is generated if
146            <em class="parameter"><code>display</code></em> has not been initialized.
147        </p>
148        <p>
149            <code class="constant">EGL_BAD_SURFACE</code> is generated if
150            <em class="parameter"><code>draw</code></em> or <em class="parameter"><code>read</code></em> is not an
151            EGL surface.
152        </p>
153        <p>
154            <code class="constant">EGL_BAD_CONTEXT</code> is generated if
155            <em class="parameter"><code>context</code></em> is not an EGL rendering context.
156        </p>
157        <p>
158            <code class="constant">EGL_BAD_MATCH</code> is generated if
159            <em class="parameter"><code>draw</code></em> or
160            <em class="parameter"><code>read</code></em>
161            are not compatible with
162            <em class="parameter"><code>context</code></em>, or if
163            <em class="parameter"><code>context</code></em> is set to
164            <code class="constant">EGL_NO_CONTEXT</code> and
165            <em class="parameter"><code>draw</code></em> or
166            <em class="parameter"><code>read</code></em>
167            are not set to
168            <code class="constant">EGL_NO_SURFACE</code>, or if
169            <em class="parameter"><code>draw</code></em> or
170            <em class="parameter"><code>read</code></em> are set to
171            <code class="constant">EGL_NO_SURFACE</code> and
172            <em class="parameter"><code>context</code></em> is not set to
173            <code class="constant">EGL_NO_CONTEXT</code>.
174        </p>
175        <p>
176            <code class="constant">EGL_BAD_ACCESS</code> is generated if
177            <em class="parameter"><code>context</code></em>
178            is current to some other thread.
179        </p>
180        <p>
181            <code class="constant">EGL_BAD_NATIVE_PIXMAP</code> may be generated if
182            a native pixmap underlying either
183            <em class="parameter"><code>draw</code></em> or
184            <em class="parameter"><code>read</code></em>
185            is no longer valid.
186        </p>
187        <p>
188            <code class="constant">EGL_BAD_NATIVE_WINDOW</code> may be generated if
189            a native window underlying either
190            <em class="parameter"><code>draw</code></em> or
191            <em class="parameter"><code>read</code></em>
192            is no longer valid.
193        </p>
194        <p>
195            <code class="constant">EGL_BAD_CURRENT_SURFACE</code> is generated if
196            the previous context has unflushed commands and the previous surface
197            is no longer valid.
198        </p>
199        <p>
200            <code class="constant">EGL_BAD_ALLOC</code> may be generated if
201            allocation of ancillary buffers for <em class="parameter"><code>draw</code></em> or
202            <em class="parameter"><code>read</code></em> were delayed until
203            <code class="function">eglMakeCurrent</code> is called, and there are not
204            enough resources to allocate them.
205        </p>
206        <p>
207            <code class="constant">EGL_CONTEXT_LOST</code> is generated if a power management
208            event has occurred. The application must destroy all contexts and
209            reinitialise OpenGL ES state and objects to continue rendering.
210        </p>
211      </div>
212      <div class="refsect1" id="seealso">
213        <h2>See Also</h2>
214        <p>
215            <a class="citerefentry" href="glReadPixels.xhtml"><span class="citerefentry"><span class="refentrytitle">glReadPixels</span></span></a>,
216            <a class="citerefentry" href="glCopyTexImage2D.xhtml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage2D</span></span></a>,
217            <a class="citerefentry" href="glCopyTexSubImage2D.xhtml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage2D</span></span></a>,
218            <a class="citerefentry" href="eglCreateContext.xhtml"><span class="citerefentry"><span class="refentrytitle">eglCreateContext</span></span></a>,
219            <a class="citerefentry" href="eglCreatePbufferSurface.xhtml"><span class="citerefentry"><span class="refentrytitle">eglCreatePbufferSurface</span></span></a>,
220            <a class="citerefentry" href="eglCreatePixmapSurface.xhtml"><span class="citerefentry"><span class="refentrytitle">eglCreatePixmapSurface</span></span></a>,
221            <a class="citerefentry" href="eglCreateWindowSurface.xhtml"><span class="citerefentry"><span class="refentrytitle">eglCreateWindowSurface</span></span></a>,
222            <a class="citerefentry" href="eglGetCurrentContext.xhtml"><span class="citerefentry"><span class="refentrytitle">eglGetCurrentContext</span></span></a>,
223            <a class="citerefentry" href="eglGetCurrentDisplay.xhtml"><span class="citerefentry"><span class="refentrytitle">eglGetCurrentDisplay</span></span></a>,
224            <a class="citerefentry" href="eglGetCurrentSurface.xhtml"><span class="citerefentry"><span class="refentrytitle">eglGetCurrentSurface</span></span></a>,
225            <a class="citerefentry" href="eglGetDisplay.xhtml"><span class="citerefentry"><span class="refentrytitle">eglGetDisplay</span></span></a>,
226            <a class="citerefentry" href="eglInitialize.xhtml"><span class="citerefentry"><span class="refentrytitle">eglInitialize</span></span></a>
227        </p>
228      </div>
229      <p>
230    </p>
231      <div class="refsect3" id="copyright">
232        <img src="KhronosLogo.jpg"/>
233        <p>
234            Copyright © 2003-2014 The Khronos Group Inc.
235            Permission is hereby granted, free of charge, to any person obtaining a
236            copy of this software and/or associated documentation files (the
237            "Materials"), to deal in the Materials without restriction, including
238            without limitation the rights to use, copy, modify, merge, publish,
239            distribute, sublicense, and/or sell copies of the Materials, and to
240            permit persons to whom the Materials are furnished to do so, subject to
241            the condition that this copyright notice and permission notice shall be included
242            in all copies or substantial portions of the Materials.
243        </p>
244      </div>
245      <p>
246</p>
247    </div>
248    <footer/>
249  </body>
250</html>
251