summaryrefslogtreecommitdiff
path: root/glew/auto/EGL-Registry/sdk/docs/man/html/eglMakeCurrent.xhtml
blob: 14f28ec9f149e2cc5dd8dd06b2ce1cf80f2ba98f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title xmlns:xlink="http://www.w3.org/1999/xlink">eglMakeCurrent - EGL Reference Pages</title>
    <link rel="stylesheet" type="text/css" href="khronos-man.css"/>
    <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"/>
  </head>
  <body>
    <header/>
    <div class="refentry" id="eglMakeCurrent">
      <div class="titlepage"/>
      <div class="refnamediv">
        <h2>Name</h2>
        <p>eglMakeCurrent — 
            attach an EGL rendering context to EGL surfaces
        </p>
      </div>
      <div class="refsynopsisdiv">
        <h2>C Specification</h2>
        <div class="funcsynopsis">
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">EGLBoolean <strong class="fsfunc">eglMakeCurrent</strong>(</code>
              </td>
              <td>EGLDisplay <var class="pdparam">display</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>EGLSurface <var class="pdparam">draw</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>EGLSurface <var class="pdparam">read</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>EGLContext <var class="pdparam">context</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
        </div>
      </div>
      <div class="refsect1" id="parameters">
        <h2>Parameters</h2>
        <div class="variablelist">
          <dl class="variablelist">
            <dt>
              <span class="term">
                <em class="parameter">
                  <code>display</code>
                </em>
              </span>
            </dt>
            <dd>
              <p>Specifies the <abbr class="acronym">EGL</abbr> display connection.</p>
            </dd>
            <dt>
              <span class="term">
                <em class="parameter">
                  <code>draw</code>
                </em>
              </span>
            </dt>
            <dd>
              <p>Specifies the <abbr class="acronym">EGL</abbr> draw surface.</p>
            </dd>
            <dt>
              <span class="term">
                <em class="parameter">
                  <code>read</code>
                </em>
              </span>
            </dt>
            <dd>
              <p>Specifies the <abbr class="acronym">EGL</abbr> read surface.</p>
            </dd>
            <dt>
              <span class="term">
                <em class="parameter">
                  <code>context</code>
                </em>
              </span>
            </dt>
            <dd>
              <p>Specifies the <abbr class="acronym">EGL</abbr> rendering context
                        to be attached to the surfaces.
                    </p>
            </dd>
          </dl>
        </div>
      </div>
      <div class="refsect1" id="description">
        <h2>Description</h2>
        <p>
            <code class="function">eglMakeCurrent</code> binds <em class="parameter"><code>context</code></em>
            to the current rendering thread and to the <em class="parameter"><code>draw</code></em>
            and <em class="parameter"><code>read</code></em> surfaces.
        </p>
        <p>
            For an OpenGL or OpenGL ES context, <em class="parameter"><code>draw</code></em>
            is used for all operations except for any pixel data read back or copied
            (<a class="citerefentry" href="glReadPixels.xhtml"><span class="citerefentry"><span class="refentrytitle">glReadPixels</span></span></a>,
            <a class="citerefentry" href="glCopyTexImage2D.xhtml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage2D</span></span></a>, and
            <a class="citerefentry" href="glCopyTexSubImage2D.xhtml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage2D</span></span></a>),
            which is taken from the frame buffer values of
            <em class="parameter"><code>read</code></em>. Note that the same
            <span class="type">EGLSurface</span> may be specified for both draw and read.
        </p>
        <p>
            For an OpenVG context, the same <span class="type">EGLSurface</span> must be
            specified for both <em class="parameter"><code>draw</code></em> and
            <em class="parameter"><code>read</code></em>.
        </p>
        <p>
            If the calling thread has already a current rendering context of
            the same client API type as <em class="parameter"><code>context</code></em>, then
            that context is flushed and marked as no longer current.
            <em class="parameter"><code>context</code></em> is then made the current context
            for the calling thread. For purposes of
            <code class="function">eglMakeCurrent</code>, the client API type of all
            OpenGL ES and OpenGL contexts is considered the same. In other
            words, if any OpenGL ES context is currently bound and
            <em class="parameter"><code>context</code></em> is an OpenGL context, or if any
            OpenGL context is currently bound and
            <em class="parameter"><code>context</code></em> is an OpenGL ES context, the
            currently bound context will be made no longer current and
            <em class="parameter"><code>context</code></em> will be made current.
        </p>
        <p>
            OpenGL and OpenGL ES buffer mappings created by e.g.
            <code class="function">glMapBuffer</code> are not affected by
            <code class="function">eglMakeCurrent</code>; they persist whether the
            context owning the buffer is current or not.
        </p>
        <p>
            If <em class="parameter"><code>draw</code></em> is destroyed after
            <code class="function">eglMakeCurrent</code> is called, then subsequent
            rendering commands will be processed and the context state will
            be updated, but the surface contents become undefined. If
            <em class="parameter"><code>read</code></em> is destroyed after
            <code class="function">eglMakeCurrent</code> then pixel values
            <em class="parameter"><code>read</code></em> from the framebuffer (e.g., as
            result of calling glReadPixels) are undefined. If a native
            window or pixmap underlying the <em class="parameter"><code>draw</code></em> or
            <em class="parameter"><code>read</code></em> surfaces is destroyed, rendering and
            <em class="parameter"><code>read</code></em>back are handled as above.
        </p>
        <p>
            To release the current context without assigning a new one, set
            <em class="parameter"><code>context</code></em> to
            <code class="constant">EGL_NO_CONTEXT</code> and set
            <em class="parameter"><code>draw</code></em> and <em class="parameter"><code>read</code></em> to
            <code class="constant">EGL_NO_SURFACE</code> . The currently bound
            context for the client API specified by the current rendering
            API is flushed and marked as no longer current, and there will
            be no current context for that client API after
            <code class="function">eglMakeCurrent</code> returns. This is the only
            case in which <code class="function">eglMakeCurrent</code> respects the
            current rendering API. In all other cases, the client API
            affected is determined by <em class="parameter"><code>context</code></em>. This
            is the only case where an uninitialized display may be passed to
            <code class="function">eglMakeCurrent</code>.
        </p>
        <p>
            If ctx is not <code class="constant">EGL_NO_CONTEXT</code>, then both
            <em class="parameter"><code>draw</code></em> and <em class="parameter"><code>read</code></em> must
            not be <code class="constant">EGL_NO_SURFACE</code> unless
            <em class="parameter"><code>context</code></em> is a context which supports being
            bound without read and draw surfaces. In this case the context
            is made current without a default framebuffer. The meaning of
            this is defined by the client API of the supporting context (see
            chapter 4 of the OpenGL 3.0 Specification, and the
            <code class="constant">GL_OES_surfaceless_context</code> OpenGL ES
            extension.).
        </p>
        <p>
            The first time a OpenGL or OpenGL ES context is made current the
            viewport and scissor dimensions are set to the size of the
            <em class="parameter"><code>draw</code></em> surface (as though
            <code class="function">glViewport</code>(0,0,w,h) and
            <code class="function">glScissor</code>(0,0,<em class="parameter"><code>w</code></em>,<em class="parameter"><code>h</code></em>)
            were called, where <em class="parameter"><code>w</code></em> and
            <em class="parameter"><code>h</code></em> are the width and height of the
            surface, respectively). However, the viewport and scissor
            dimensions are not modified when <em class="parameter"><code>context</code></em>
            is subsequently made current. The client is responsible for
            resetting the viewport and scissor in this case.
        </p>
        <p>
            The first time <em class="parameter"><code>context</code></em> is made current,
            if it is without a default framebuffer (e.g. both
            <em class="parameter"><code>draw</code></em> and <em class="parameter"><code>read</code></em> are
            <code class="constant">EGL_NO_SURFACE</code> ), then the viewport and
            scissor regions are set as though
            <code class="function">glViewport</code>(0,0,0,0) and
            <code class="function">glScissor</code>(0,0,0,0) were called.
        </p>
        <p>
            Implementations may delay allocation of auxiliary buffers for a
            surface until they are required by a context (which may result
            in the <code class="constant">EGL_BAD_ALLOC</code> error described
            above). Once allocated, however, auxiliary buffers and their
            contents persist until a surface is deleted.
        </p>
        <p>
            Use
            <a class="citerefentry" href="eglGetCurrentContext.xhtml"><span class="citerefentry"><span class="refentrytitle">eglGetCurrentContext</span></span></a>,
            <a class="citerefentry" href="eglGetCurrentDisplay.xhtml"><span class="citerefentry"><span class="refentrytitle">eglGetCurrentDisplay</span></span></a>, and
            <a class="citerefentry" href="eglGetCurrentSurface.xhtml"><span class="citerefentry"><span class="refentrytitle">eglGetCurrentSurface</span></span></a>
            to query the current rendering context and associated display connection and surfaces.
        </p>
      </div>
      <div class="refsect1" id="errors">
        <h2>Errors</h2>
        <p>
            If <em class="parameter"><code>draw</code></em> or <em class="parameter"><code>read</code></em>
            are not compatible with <em class="parameter"><code>context</code></em>, then an
            <code class="constant">EGL_BAD_MATCH</code> error is generated.
        </p>
        <p>
            If <em class="parameter"><code>context</code></em> is current to some other
            thread, or if either <em class="parameter"><code>draw</code></em> or
            <em class="parameter"><code>read</code></em> are bound to contexts in another
            thread, an <code class="constant">EGL_BAD_ACCESS</code> error is
            generated.
        </p>
        <p>
            If binding <em class="parameter"><code>context</code></em> would exceed the
            number of current contexts of that client API type supported by
            the implementation, an <code class="constant">EGL_BAD_ACCESS</code> error
            is generated.
        </p>
        <p>
            If either <em class="parameter"><code>draw</code></em> or
            <em class="parameter"><code>read</code></em> are pbuffers created with
            <code class="function">eglCreatePbufferFromClientBuffer</code>, and the
            underlying bound client API buffers are in use by the client API
            that created them, an <code class="constant">EGL_BAD_ACCESS</code> error
            is generated.
        </p>
        <p>
            If <em class="parameter"><code>context</code></em> is not a valid context and is
            not <code class="constant">EGL_NO_CONTEXT</code>, an
            <code class="constant">EGL_BAD_CONTEXT</code> error is generated.
        </p>
        <p>
            If either <em class="parameter"><code>draw</code></em> or
            <em class="parameter"><code>read</code></em> are not valid EGL surfaces and are
            not <code class="constant">EGL_NO_SURFACE</code>, an
            <code class="constant">EGL_BAD_SURFACE</code> error is generated.
        </p>
        <p>
            If <em class="parameter"><code>context</code></em> is
            <code class="constant">EGL_NO_CONTEXT</code> and either
            <em class="parameter"><code>draw</code></em> or <em class="parameter"><code>read</code></em> are
            not <code class="constant">EGL_NO_SURFACE</code>, an
            <code class="constant">EGL_BAD_MATCH</code> error is generated.
        </p>
        <p>
            If either of <em class="parameter"><code>draw</code></em> or
            <em class="parameter"><code>read</code></em> is a valid surface and the other is
            <code class="constant">EGL_NO_SURFACE</code>, an
            <code class="constant">EGL_BAD_MATCH</code> error is generated.
        </p>
        <p>
            If <em class="parameter"><code>context</code></em> does not support being bound
            without <em class="parameter"><code>read</code></em> and
            <em class="parameter"><code>draw</code></em> surfaces, and both
            <em class="parameter"><code>draw</code></em> and <em class="parameter"><code>read</code></em> are
            <code class="constant">EGL_NO_SURFACE</code>, an
            <code class="constant">EGL_BAD_MATCH</code> error is generated.
        </p>
        <p>
            If a native window underlying either <em class="parameter"><code>draw</code></em>
            or <em class="parameter"><code>read</code></em> is no longer valid, an
            <code class="constant">EGL_BAD_NATIVE_WINDOW</code> error is generated.
        </p>
        <p>
            If <em class="parameter"><code>draw</code></em> and <em class="parameter"><code>read</code></em>
            cannot fit into graphics memory simultaneously, an
            <code class="constant">EGL_BAD_MATCH</code> error is generated.
        </p>
        <p>
            If the previous context of the calling thread has unflushed
            commands, and the previous surface is no longer valid, an
            <code class="constant">EGL_BAD_CURRENT_SURFACE</code> error is generated.
        </p>
        <p>
            If the ancillary buffers for <em class="parameter"><code>draw</code></em> and
            <em class="parameter"><code>read</code></em> cannot be allocated, an
            <code class="constant">EGL_BAD_ALLOC</code> error is generated.
        </p>
        <p>
            If a power management event has occurred, an
            <code class="constant">EGL_CONTEXT_LOST</code> error is generated.
        </p>
        <p>
            If any of the following are true:

            </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" style="list-style-type: disc; ">
            <li class="listitem">
              <p>
                    <em class="parameter"><code>context</code></em> is not
                    <code class="constant">EGL_NO_CONTEXT</code>
                </p>
            </li>
            <li class="listitem">
              <p>
                    <em class="parameter"><code>read</code></em> is not
                    <code class="constant">EGL_NO_SURFACE</code>
                </p>
            </li>
            <li class="listitem">
              <p>
                    <em class="parameter"><code>draw</code></em> is not
                    <code class="constant">EGL_NO_SURFACE</code>
                </p>
            </li>
          </ul>
        </div>
        <p>

            then an <code class="constant">EGL_NOT_INITIALIZED</code> error is
            generated if <em class="parameter"><code>display</code></em> is a valid but
            uninitialized display.
        </p>
        <p>
            As with other commands taking <span class="type">EGLDisplay</span>
            parameters, if <em class="parameter"><code>display</code></em> is not a valid
            <span class="type">EGLDisplay</span> handle, an
            <code class="constant">EGL_BAD_DISPLAY</code> error is generated. (Some
            implementations have chosen to allow
            <code class="constant">EGL_NO_DISPLAY</code> as a valid
            <em class="parameter"><code>display</code></em> parameter for
            <code class="function">eglMakeCurrent</code>. This behavior is not
            portable to all EGL implementations, and should be considered as
            an undocumented vendor extension).
        </p>
      </div>
      <div class="refsect1" id="seealso">
        <h2>See Also</h2>
        <p>
            <a class="citerefentry" href="glReadPixels.xhtml"><span class="citerefentry"><span class="refentrytitle">glReadPixels</span></span></a>,
            <a class="citerefentry" href="glCopyTexImage2D.xhtml"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage2D</span></span></a>,
            <a class="citerefentry" href="glCopyTexSubImage2D.xhtml"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage2D</span></span></a>,
            <a class="citerefentry" href="eglCreateContext.xhtml"><span class="citerefentry"><span class="refentrytitle">eglCreateContext</span></span></a>,
            <a class="citerefentry" href="eglCreatePbufferSurface.xhtml"><span class="citerefentry"><span class="refentrytitle">eglCreatePbufferSurface</span></span></a>,
            <a class="citerefentry" href="eglCreatePixmapSurface.xhtml"><span class="citerefentry"><span class="refentrytitle">eglCreatePixmapSurface</span></span></a>,
            <a class="citerefentry" href="eglCreateWindowSurface.xhtml"><span class="citerefentry"><span class="refentrytitle">eglCreateWindowSurface</span></span></a>,
            <a class="citerefentry" href="eglGetCurrentContext.xhtml"><span class="citerefentry"><span class="refentrytitle">eglGetCurrentContext</span></span></a>,
            <a class="citerefentry" href="eglGetCurrentDisplay.xhtml"><span class="citerefentry"><span class="refentrytitle">eglGetCurrentDisplay</span></span></a>,
            <a class="citerefentry" href="eglGetCurrentSurface.xhtml"><span class="citerefentry"><span class="refentrytitle">eglGetCurrentSurface</span></span></a>,
            <a class="citerefentry" href="eglGetDisplay.xhtml"><span class="citerefentry"><span class="refentrytitle">eglGetDisplay</span></span></a>,
            <a class="citerefentry" href="eglInitialize.xhtml"><span class="citerefentry"><span class="refentrytitle">eglInitialize</span></span></a>
        </p>
      </div>
      <p>
    </p>
      <div class="refsect3" id="copyright">
        <img src="KhronosLogo.jpg"/>
        <p>
            Copyright © 2003-2014 The Khronos Group Inc.
            Permission is hereby granted, free of charge, to any person obtaining a
            copy of this software and/or associated documentation files (the
            "Materials"), to deal in the Materials without restriction, including
            without limitation the rights to use, copy, modify, merge, publish,
            distribute, sublicense, and/or sell copies of the Materials, and to
            permit persons to whom the Materials are furnished to do so, subject to
            the condition that this copyright notice and permission notice shall be included
            in all copies or substantial portions of the Materials.
        </p>
      </div>
      <p>
</p>
    </div>
    <footer/>
  </body>
</html>