• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3                            "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4<refentry xml:base="" id="eglMakeCurrent">
5    <refentryinfo>
6         <copyright>
7             <year>2003-2014</year>
8             <holder>The Khronos Group Inc.</holder>
9         </copyright>
10    </refentryinfo>
11    <refmeta>
12        <refentrytitle>eglMakeCurrent</refentrytitle>
13        <manvolnum>3G</manvolnum>
14    </refmeta>
15    <refnamediv>
16        <refname>eglMakeCurrent</refname>
17        <refpurpose>
18            attach an EGL rendering context to EGL surfaces
19        </refpurpose>
20    </refnamediv>
21    <refsynopsisdiv>
22        <title>C Specification</title>
23        <funcsynopsis>
24            <funcprototype>
25                <funcdef>EGLBoolean <function>eglMakeCurrent</function></funcdef>
26                <paramdef>EGLDisplay <parameter>display</parameter></paramdef>
27                <paramdef>EGLSurface <parameter>draw</parameter></paramdef>
28                <paramdef>EGLSurface <parameter>read</parameter></paramdef>
29                <paramdef>EGLContext <parameter>context</parameter></paramdef>
30            </funcprototype>
31        </funcsynopsis>
32    </refsynopsisdiv>
33    <refsect1 id="parameters"><title>Parameters</title>
34        <variablelist>
35            <varlistentry>
36                <term><parameter>display</parameter></term>
37                <listitem>
38                    <para>Specifies the <acronym>EGL</acronym> display connection.</para>
39                </listitem>
40            </varlistentry>
41            <varlistentry>
42                <term><parameter>draw</parameter></term>
43                <listitem>
44                    <para>Specifies the <acronym>EGL</acronym> draw surface.</para>
45                </listitem>
46            </varlistentry>
47            <varlistentry>
48                <term><parameter>read</parameter></term>
49                <listitem>
50                    <para>Specifies the <acronym>EGL</acronym> read surface.</para>
51                </listitem>
52            </varlistentry>
53            <varlistentry>
54                <term><parameter>context</parameter></term>
55                <listitem>
56                    <para>Specifies the <acronym>EGL</acronym> rendering context
57                        to be attached to the surfaces.
58                    </para>
59                </listitem>
60            </varlistentry>
61        </variablelist>
62    </refsect1>
63    <refsect1 id="description"><title>Description</title>
64        <para>
65            <function>eglMakeCurrent</function> binds <parameter>context</parameter>
66            to the current rendering thread and to the <parameter>draw</parameter>
67            and <parameter>read</parameter> surfaces. <parameter>draw</parameter>
68            is used for all GL operations except for any pixel data read back
69            (<citerefentry><refentrytitle>glReadPixels</refentrytitle></citerefentry>,
70            <citerefentry><refentrytitle>glCopyTexImage2D</refentrytitle></citerefentry>, and
71            <citerefentry><refentrytitle>glCopyTexSubImage2D</refentrytitle></citerefentry>),
72            which is taken from the frame buffer values of
73            <parameter>read</parameter>.
74        </para>
75        <para>
76            If the calling thread has already a current rendering context, that
77            context is flushed and marked as no longer current.
78        </para>
79        <para>
80            The first time that <parameter>context</parameter> is made current,
81            the viewport and scissor dimensions are set to the size of the
82            <parameter>draw</parameter> surface. The viewport and
83            scissor are not modified when <parameter>context</parameter> is
84            subsequently made current.
85        </para>
86        <para>
87            To release the current context without assigning a new one, call
88            <function>eglMakeCurrent</function> with <parameter>draw</parameter>
89            and <parameter>read</parameter> set to
90            <constant>EGL_NO_SURFACE</constant> and <parameter>context</parameter>
91            set to <constant>EGL_NO_CONTEXT</constant>.
92        </para>
93        <para>
94            Use
95            <citerefentry><refentrytitle>eglGetCurrentContext</refentrytitle></citerefentry>,
96            <citerefentry><refentrytitle>eglGetCurrentDisplay</refentrytitle></citerefentry>, and
97            <citerefentry><refentrytitle>eglGetCurrentSurface</refentrytitle></citerefentry>
98            to query the current rendering context and associated display connection and surfaces.
99        </para>
100    </refsect1>
101    <refsect1 id="errors"><title>Errors</title>
102        <para>
103            <constant>EGL_FALSE</constant> is returned on failure,
104            <constant>EGL_TRUE</constant> otherwise. If <constant>EGL_FALSE</constant>
105            is returned, the previously current rendering context and
106            surfaces (if any) remain unchanged.
107        </para>
108        <para>
109            <constant>EGL_BAD_DISPLAY</constant> is generated if
110            <parameter>display</parameter> is not an EGL display connection.
111        </para>
112        <para>
113            <constant>EGL_NOT_INITIALIZED</constant> is generated if
114            <parameter>display</parameter> has not been initialized.
115        </para>
116        <para>
117            <constant>EGL_BAD_SURFACE</constant> is generated if
118            <parameter>draw</parameter> or <parameter>read</parameter> is not an
119            EGL surface.
120        </para>
121        <para>
122            <constant>EGL_BAD_CONTEXT</constant> is generated if
123            <parameter>context</parameter> is not an EGL rendering context.
124        </para>
125        <para>
126            <constant>EGL_BAD_MATCH</constant> is generated if
127            <parameter>draw</parameter> or
128            <parameter>read</parameter>
129            are not compatible with
130            <parameter>context</parameter>, or if
131            <parameter>context</parameter> is set to
132            <constant>EGL_NO_CONTEXT</constant> and
133            <parameter>draw</parameter> or
134            <parameter>read</parameter>
135            are not set to
136            <constant>EGL_NO_SURFACE</constant>, or if
137            <parameter>draw</parameter> or
138            <parameter>read</parameter> are set to
139            <constant>EGL_NO_SURFACE</constant> and
140            <parameter>context</parameter> is not set to
141            <constant>EGL_NO_CONTEXT</constant>.
142        </para>
143        <para>
144            <constant>EGL_BAD_ACCESS</constant> is generated if
145            <parameter>context</parameter>
146            is current to some other thread.
147        </para>
148        <para>
149            <constant>EGL_BAD_NATIVE_PIXMAP</constant> may be generated if
150            a native pixmap underlying either
151            <parameter>draw</parameter> or
152            <parameter>read</parameter>
153            is no longer valid.
154        </para>
155        <para>
156            <constant>EGL_BAD_NATIVE_WINDOW</constant> may be generated if
157            a native window underlying either
158            <parameter>draw</parameter> or
159            <parameter>read</parameter>
160            is no longer valid.
161        </para>
162        <para>
163            <constant>EGL_BAD_CURRENT_SURFACE</constant> is generated if
164            the previous context has unflushed commands and the previous surface
165            is no longer valid.
166        </para>
167        <para>
168            <constant>EGL_BAD_ALLOC</constant> may be generated if
169            allocation of ancillary buffers for <parameter>draw</parameter> or
170            <parameter>read</parameter> were delayed until
171            <function>eglMakeCurrent</function> is called, and there are not
172            enough resources to allocate them.
173        </para>
174        <para>
175            <constant>EGL_CONTEXT_LOST</constant> is generated if a power management
176            event has occurred. The application must destroy all contexts and
177            reinitialise OpenGL ES state and objects to continue rendering.
178        </para>
179    </refsect1>
180    <refsect1 id="seealso"><title>See Also</title>
181        <para>
182            <citerefentry><refentrytitle>glReadPixels</refentrytitle></citerefentry>,
183            <citerefentry><refentrytitle>glCopyTexImage2D</refentrytitle></citerefentry>,
184            <citerefentry><refentrytitle>glCopyTexSubImage2D</refentrytitle></citerefentry>,
185            <citerefentry><refentrytitle>eglCreateContext</refentrytitle></citerefentry>,
186            <citerefentry><refentrytitle>eglCreatePbufferSurface</refentrytitle></citerefentry>,
187            <citerefentry><refentrytitle>eglCreatePixmapSurface</refentrytitle></citerefentry>,
188            <citerefentry><refentrytitle>eglCreateWindowSurface</refentrytitle></citerefentry>,
189            <citerefentry><refentrytitle>eglGetCurrentContext</refentrytitle></citerefentry>,
190            <citerefentry><refentrytitle>eglGetCurrentDisplay</refentrytitle></citerefentry>,
191            <citerefentry><refentrytitle>eglGetCurrentSurface</refentrytitle></citerefentry>,
192            <citerefentry><refentrytitle>eglGetDisplay</refentrytitle></citerefentry>,
193            <citerefentry><refentrytitle>eglInitialize</refentrytitle></citerefentry>
194        </para>
195    </refsect1>
196    <refsect3 id="Copyright"><title></title>
197        <!-- Content included from copyright.inc.xsl -->
198        <imageobject>
199                <imagedata fileref="KhronosLogo.jpg" format="jpg" />
200        </imageobject>
201        <para />
202    </refsect3>
203</refentry>
204