102f4aeb0Sopenharmony_ci<?xml version="1.0" encoding="UTF-8"?>
202f4aeb0Sopenharmony_ci<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
302f4aeb0Sopenharmony_ci                            "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
402f4aeb0Sopenharmony_ci<refentry xml:base="" id="eglMakeCurrent">
502f4aeb0Sopenharmony_ci    <refentryinfo>
602f4aeb0Sopenharmony_ci         <copyright>
702f4aeb0Sopenharmony_ci             <year>2003-2014</year>
802f4aeb0Sopenharmony_ci             <holder>The Khronos Group Inc.</holder>
902f4aeb0Sopenharmony_ci         </copyright>
1002f4aeb0Sopenharmony_ci    </refentryinfo>
1102f4aeb0Sopenharmony_ci    <refmeta>
1202f4aeb0Sopenharmony_ci        <refentrytitle>eglMakeCurrent</refentrytitle>
1302f4aeb0Sopenharmony_ci        <manvolnum>3G</manvolnum>
1402f4aeb0Sopenharmony_ci    </refmeta>
1502f4aeb0Sopenharmony_ci    <refnamediv>
1602f4aeb0Sopenharmony_ci        <refname>eglMakeCurrent</refname>
1702f4aeb0Sopenharmony_ci        <refpurpose>
1802f4aeb0Sopenharmony_ci            attach an EGL rendering context to EGL surfaces
1902f4aeb0Sopenharmony_ci        </refpurpose>
2002f4aeb0Sopenharmony_ci    </refnamediv>
2102f4aeb0Sopenharmony_ci    <refsynopsisdiv>
2202f4aeb0Sopenharmony_ci        <title>C Specification</title>
2302f4aeb0Sopenharmony_ci        <funcsynopsis>
2402f4aeb0Sopenharmony_ci            <funcprototype>
2502f4aeb0Sopenharmony_ci                <funcdef>EGLBoolean <function>eglMakeCurrent</function></funcdef>
2602f4aeb0Sopenharmony_ci                <paramdef>EGLDisplay <parameter>display</parameter></paramdef>
2702f4aeb0Sopenharmony_ci                <paramdef>EGLSurface <parameter>draw</parameter></paramdef>
2802f4aeb0Sopenharmony_ci                <paramdef>EGLSurface <parameter>read</parameter></paramdef>
2902f4aeb0Sopenharmony_ci                <paramdef>EGLContext <parameter>context</parameter></paramdef>
3002f4aeb0Sopenharmony_ci            </funcprototype>
3102f4aeb0Sopenharmony_ci        </funcsynopsis>
3202f4aeb0Sopenharmony_ci    </refsynopsisdiv>
3302f4aeb0Sopenharmony_ci    <refsect1 id="parameters"><title>Parameters</title>
3402f4aeb0Sopenharmony_ci        <variablelist>
3502f4aeb0Sopenharmony_ci            <varlistentry>
3602f4aeb0Sopenharmony_ci                <term><parameter>display</parameter></term>
3702f4aeb0Sopenharmony_ci                <listitem>
3802f4aeb0Sopenharmony_ci                    <para>Specifies the <acronym>EGL</acronym> display connection.</para>
3902f4aeb0Sopenharmony_ci                </listitem>
4002f4aeb0Sopenharmony_ci            </varlistentry>
4102f4aeb0Sopenharmony_ci            <varlistentry>
4202f4aeb0Sopenharmony_ci                <term><parameter>draw</parameter></term>
4302f4aeb0Sopenharmony_ci                <listitem>
4402f4aeb0Sopenharmony_ci                    <para>Specifies the <acronym>EGL</acronym> draw surface.</para>
4502f4aeb0Sopenharmony_ci                </listitem>
4602f4aeb0Sopenharmony_ci            </varlistentry>
4702f4aeb0Sopenharmony_ci            <varlistentry>
4802f4aeb0Sopenharmony_ci                <term><parameter>read</parameter></term>
4902f4aeb0Sopenharmony_ci                <listitem>
5002f4aeb0Sopenharmony_ci                    <para>Specifies the <acronym>EGL</acronym> read surface.</para>
5102f4aeb0Sopenharmony_ci                </listitem>
5202f4aeb0Sopenharmony_ci            </varlistentry>
5302f4aeb0Sopenharmony_ci            <varlistentry>
5402f4aeb0Sopenharmony_ci                <term><parameter>context</parameter></term>
5502f4aeb0Sopenharmony_ci                <listitem>
5602f4aeb0Sopenharmony_ci                    <para>Specifies the <acronym>EGL</acronym> rendering context
5702f4aeb0Sopenharmony_ci                        to be attached to the surfaces.
5802f4aeb0Sopenharmony_ci                    </para>
5902f4aeb0Sopenharmony_ci                </listitem>
6002f4aeb0Sopenharmony_ci            </varlistentry>
6102f4aeb0Sopenharmony_ci        </variablelist>
6202f4aeb0Sopenharmony_ci    </refsect1>
6302f4aeb0Sopenharmony_ci    <refsect1 id="description"><title>Description</title>
6402f4aeb0Sopenharmony_ci        <para>
6502f4aeb0Sopenharmony_ci            <function>eglMakeCurrent</function> binds <parameter>context</parameter>
6602f4aeb0Sopenharmony_ci            to the current rendering thread and to the <parameter>draw</parameter>
6702f4aeb0Sopenharmony_ci            and <parameter>read</parameter> surfaces. <parameter>draw</parameter>
6802f4aeb0Sopenharmony_ci            is used for all GL operations except for any pixel data read back
6902f4aeb0Sopenharmony_ci            (<citerefentry><refentrytitle>glReadPixels</refentrytitle></citerefentry>,
7002f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>glCopyTexImage2D</refentrytitle></citerefentry>, and
7102f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>glCopyTexSubImage2D</refentrytitle></citerefentry>),
7202f4aeb0Sopenharmony_ci            which is taken from the frame buffer values of
7302f4aeb0Sopenharmony_ci            <parameter>read</parameter>.
7402f4aeb0Sopenharmony_ci        </para>
7502f4aeb0Sopenharmony_ci        <para>
7602f4aeb0Sopenharmony_ci            If the calling thread has already a current rendering context, that
7702f4aeb0Sopenharmony_ci            context is flushed and marked as no longer current.
7802f4aeb0Sopenharmony_ci        </para>
7902f4aeb0Sopenharmony_ci        <para>
8002f4aeb0Sopenharmony_ci            The first time that <parameter>context</parameter> is made current,
8102f4aeb0Sopenharmony_ci            the viewport and scissor dimensions are set to the size of the
8202f4aeb0Sopenharmony_ci            <parameter>draw</parameter> surface. The viewport and
8302f4aeb0Sopenharmony_ci            scissor are not modified when <parameter>context</parameter> is
8402f4aeb0Sopenharmony_ci            subsequently made current.
8502f4aeb0Sopenharmony_ci        </para>
8602f4aeb0Sopenharmony_ci        <para>
8702f4aeb0Sopenharmony_ci            To release the current context without assigning a new one, call
8802f4aeb0Sopenharmony_ci            <function>eglMakeCurrent</function> with <parameter>draw</parameter>
8902f4aeb0Sopenharmony_ci            and <parameter>read</parameter> set to
9002f4aeb0Sopenharmony_ci            <constant>EGL_NO_SURFACE</constant> and <parameter>context</parameter>
9102f4aeb0Sopenharmony_ci            set to <constant>EGL_NO_CONTEXT</constant>.
9202f4aeb0Sopenharmony_ci        </para>
9302f4aeb0Sopenharmony_ci        <para>
9402f4aeb0Sopenharmony_ci            Use
9502f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglGetCurrentContext</refentrytitle></citerefentry>,
9602f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglGetCurrentDisplay</refentrytitle></citerefentry>, and
9702f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglGetCurrentSurface</refentrytitle></citerefentry>
9802f4aeb0Sopenharmony_ci            to query the current rendering context and associated display connection and surfaces.
9902f4aeb0Sopenharmony_ci        </para>
10002f4aeb0Sopenharmony_ci    </refsect1>
10102f4aeb0Sopenharmony_ci    <refsect1 id="errors"><title>Errors</title>
10202f4aeb0Sopenharmony_ci        <para>
10302f4aeb0Sopenharmony_ci            <constant>EGL_FALSE</constant> is returned on failure,
10402f4aeb0Sopenharmony_ci            <constant>EGL_TRUE</constant> otherwise. If <constant>EGL_FALSE</constant>
10502f4aeb0Sopenharmony_ci            is returned, the previously current rendering context and
10602f4aeb0Sopenharmony_ci            surfaces (if any) remain unchanged.
10702f4aeb0Sopenharmony_ci        </para>
10802f4aeb0Sopenharmony_ci        <para>
10902f4aeb0Sopenharmony_ci            <constant>EGL_BAD_DISPLAY</constant> is generated if
11002f4aeb0Sopenharmony_ci            <parameter>display</parameter> is not an EGL display connection.
11102f4aeb0Sopenharmony_ci        </para>
11202f4aeb0Sopenharmony_ci        <para>
11302f4aeb0Sopenharmony_ci            <constant>EGL_NOT_INITIALIZED</constant> is generated if
11402f4aeb0Sopenharmony_ci            <parameter>display</parameter> has not been initialized.
11502f4aeb0Sopenharmony_ci        </para>
11602f4aeb0Sopenharmony_ci        <para>
11702f4aeb0Sopenharmony_ci            <constant>EGL_BAD_SURFACE</constant> is generated if
11802f4aeb0Sopenharmony_ci            <parameter>draw</parameter> or <parameter>read</parameter> is not an
11902f4aeb0Sopenharmony_ci            EGL surface.
12002f4aeb0Sopenharmony_ci        </para>
12102f4aeb0Sopenharmony_ci        <para>
12202f4aeb0Sopenharmony_ci            <constant>EGL_BAD_CONTEXT</constant> is generated if
12302f4aeb0Sopenharmony_ci            <parameter>context</parameter> is not an EGL rendering context.
12402f4aeb0Sopenharmony_ci        </para>
12502f4aeb0Sopenharmony_ci        <para>
12602f4aeb0Sopenharmony_ci            <constant>EGL_BAD_MATCH</constant> is generated if
12702f4aeb0Sopenharmony_ci            <parameter>draw</parameter> or
12802f4aeb0Sopenharmony_ci            <parameter>read</parameter>
12902f4aeb0Sopenharmony_ci            are not compatible with
13002f4aeb0Sopenharmony_ci            <parameter>context</parameter>, or if
13102f4aeb0Sopenharmony_ci            <parameter>context</parameter> is set to
13202f4aeb0Sopenharmony_ci            <constant>EGL_NO_CONTEXT</constant> and
13302f4aeb0Sopenharmony_ci            <parameter>draw</parameter> or
13402f4aeb0Sopenharmony_ci            <parameter>read</parameter>
13502f4aeb0Sopenharmony_ci            are not set to
13602f4aeb0Sopenharmony_ci            <constant>EGL_NO_SURFACE</constant>, or if
13702f4aeb0Sopenharmony_ci            <parameter>draw</parameter> or
13802f4aeb0Sopenharmony_ci            <parameter>read</parameter> are set to
13902f4aeb0Sopenharmony_ci            <constant>EGL_NO_SURFACE</constant> and
14002f4aeb0Sopenharmony_ci            <parameter>context</parameter> is not set to
14102f4aeb0Sopenharmony_ci            <constant>EGL_NO_CONTEXT</constant>.
14202f4aeb0Sopenharmony_ci        </para>
14302f4aeb0Sopenharmony_ci        <para>
14402f4aeb0Sopenharmony_ci            <constant>EGL_BAD_ACCESS</constant> is generated if
14502f4aeb0Sopenharmony_ci            <parameter>context</parameter>
14602f4aeb0Sopenharmony_ci            is current to some other thread.
14702f4aeb0Sopenharmony_ci        </para>
14802f4aeb0Sopenharmony_ci        <para>
14902f4aeb0Sopenharmony_ci            <constant>EGL_BAD_NATIVE_PIXMAP</constant> may be generated if
15002f4aeb0Sopenharmony_ci            a native pixmap underlying either
15102f4aeb0Sopenharmony_ci            <parameter>draw</parameter> or
15202f4aeb0Sopenharmony_ci            <parameter>read</parameter>
15302f4aeb0Sopenharmony_ci            is no longer valid.
15402f4aeb0Sopenharmony_ci        </para>
15502f4aeb0Sopenharmony_ci        <para>
15602f4aeb0Sopenharmony_ci            <constant>EGL_BAD_NATIVE_WINDOW</constant> may be generated if
15702f4aeb0Sopenharmony_ci            a native window underlying either
15802f4aeb0Sopenharmony_ci            <parameter>draw</parameter> or
15902f4aeb0Sopenharmony_ci            <parameter>read</parameter>
16002f4aeb0Sopenharmony_ci            is no longer valid.
16102f4aeb0Sopenharmony_ci        </para>
16202f4aeb0Sopenharmony_ci        <para>
16302f4aeb0Sopenharmony_ci            <constant>EGL_BAD_CURRENT_SURFACE</constant> is generated if
16402f4aeb0Sopenharmony_ci            the previous context has unflushed commands and the previous surface
16502f4aeb0Sopenharmony_ci            is no longer valid.
16602f4aeb0Sopenharmony_ci        </para>
16702f4aeb0Sopenharmony_ci        <para>
16802f4aeb0Sopenharmony_ci            <constant>EGL_BAD_ALLOC</constant> may be generated if
16902f4aeb0Sopenharmony_ci            allocation of ancillary buffers for <parameter>draw</parameter> or
17002f4aeb0Sopenharmony_ci            <parameter>read</parameter> were delayed until
17102f4aeb0Sopenharmony_ci            <function>eglMakeCurrent</function> is called, and there are not
17202f4aeb0Sopenharmony_ci            enough resources to allocate them.
17302f4aeb0Sopenharmony_ci        </para>
17402f4aeb0Sopenharmony_ci        <para>
17502f4aeb0Sopenharmony_ci            <constant>EGL_CONTEXT_LOST</constant> is generated if a power management
17602f4aeb0Sopenharmony_ci            event has occurred. The application must destroy all contexts and
17702f4aeb0Sopenharmony_ci            reinitialise OpenGL ES state and objects to continue rendering.
17802f4aeb0Sopenharmony_ci        </para>
17902f4aeb0Sopenharmony_ci    </refsect1>
18002f4aeb0Sopenharmony_ci    <refsect1 id="seealso"><title>See Also</title>
18102f4aeb0Sopenharmony_ci        <para>
18202f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>glReadPixels</refentrytitle></citerefentry>,
18302f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>glCopyTexImage2D</refentrytitle></citerefentry>,
18402f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>glCopyTexSubImage2D</refentrytitle></citerefentry>,
18502f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglCreateContext</refentrytitle></citerefentry>,
18602f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglCreatePbufferSurface</refentrytitle></citerefentry>,
18702f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglCreatePixmapSurface</refentrytitle></citerefentry>,
18802f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglCreateWindowSurface</refentrytitle></citerefentry>,
18902f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglGetCurrentContext</refentrytitle></citerefentry>,
19002f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglGetCurrentDisplay</refentrytitle></citerefentry>,
19102f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglGetCurrentSurface</refentrytitle></citerefentry>,
19202f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglGetDisplay</refentrytitle></citerefentry>,
19302f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglInitialize</refentrytitle></citerefentry>
19402f4aeb0Sopenharmony_ci        </para>
19502f4aeb0Sopenharmony_ci    </refsect1>
19602f4aeb0Sopenharmony_ci    <refsect3 id="Copyright"><title></title>
19702f4aeb0Sopenharmony_ci        <!-- Content included from copyright.inc.xsl -->
19802f4aeb0Sopenharmony_ci        <imageobject>
19902f4aeb0Sopenharmony_ci                <imagedata fileref="KhronosLogo.jpg" format="jpg" />
20002f4aeb0Sopenharmony_ci        </imageobject>
20102f4aeb0Sopenharmony_ci        <para />
20202f4aeb0Sopenharmony_ci    </refsect3>
20302f4aeb0Sopenharmony_ci</refentry>
204