| <?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> |