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="eglCreateContext">
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>eglCreateContext</refentrytitle>
1302f4aeb0Sopenharmony_ci        <manvolnum>3G</manvolnum>
1402f4aeb0Sopenharmony_ci    </refmeta>
1502f4aeb0Sopenharmony_ci    <refnamediv>
1602f4aeb0Sopenharmony_ci        <refname>eglCreateContext</refname>
1702f4aeb0Sopenharmony_ci        <refpurpose>
1802f4aeb0Sopenharmony_ci            create a new <acronym>EGL</acronym> rendering context
1902f4aeb0Sopenharmony_ci        </refpurpose>
2002f4aeb0Sopenharmony_ci    </refnamediv>
2102f4aeb0Sopenharmony_ci    <refsynopsisdiv>
2202f4aeb0Sopenharmony_ci        <title>C Specification</title>
2302f4aeb0Sopenharmony_ci        <funcsynopsis>
2402f4aeb0Sopenharmony_ci            <funcprototype>
2502f4aeb0Sopenharmony_ci                <funcdef>EGLContext <function>eglCreateContext</function></funcdef>
2602f4aeb0Sopenharmony_ci                <paramdef>EGLDisplay <parameter>display</parameter></paramdef>
2702f4aeb0Sopenharmony_ci                <paramdef>EGLConfig <parameter>config</parameter></paramdef>
2802f4aeb0Sopenharmony_ci                <paramdef>EGLContext <parameter>share_context</parameter></paramdef>
2902f4aeb0Sopenharmony_ci                <paramdef>EGLint const * <parameter>attrib_list</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><para>
3802f4aeb0Sopenharmony_ci                    Specifies the
3902f4aeb0Sopenharmony_ci                    <acronym>EGL</acronym>
4002f4aeb0Sopenharmony_ci                    display connection.
4102f4aeb0Sopenharmony_ci                </para></listitem>
4202f4aeb0Sopenharmony_ci            </varlistentry>
4302f4aeb0Sopenharmony_ci            <varlistentry>
4402f4aeb0Sopenharmony_ci                <term><parameter>config</parameter></term>
4502f4aeb0Sopenharmony_ci                <listitem><para>Specifies the EGL frame buffer configuration that
4602f4aeb0Sopenharmony_ci                    defines the frame buffer resource available to the rendering context.
4702f4aeb0Sopenharmony_ci                </para></listitem>
4802f4aeb0Sopenharmony_ci            </varlistentry>
4902f4aeb0Sopenharmony_ci            <varlistentry>
5002f4aeb0Sopenharmony_ci                <term><parameter>share_context</parameter></term>
5102f4aeb0Sopenharmony_ci                <listitem><para>
5202f4aeb0Sopenharmony_ci                    Specifies another
5302f4aeb0Sopenharmony_ci                    <acronym>EGL</acronym>
5402f4aeb0Sopenharmony_ci                    rendering context with which to share data, as
5502f4aeb0Sopenharmony_ci                    defined by the client API corresponding to the
5602f4aeb0Sopenharmony_ci                    contexts. Data is also shared with all other
5702f4aeb0Sopenharmony_ci                    contexts with which
5802f4aeb0Sopenharmony_ci                    <parameter>share_context</parameter> shares data.
5902f4aeb0Sopenharmony_ci                    <constant>EGL_NO_CONTEXT</constant> indicates that
6002f4aeb0Sopenharmony_ci                    no sharing is to take place.
6102f4aeb0Sopenharmony_ci                </para>
6202f4aeb0Sopenharmony_ci                </listitem>
6302f4aeb0Sopenharmony_ci            </varlistentry>
6402f4aeb0Sopenharmony_ci            <varlistentry>
6502f4aeb0Sopenharmony_ci                <term><parameter>attrib_list</parameter></term>
6602f4aeb0Sopenharmony_ci                <listitem><para>
6702f4aeb0Sopenharmony_ci                    Specifies attributes and attribute values for the
6802f4aeb0Sopenharmony_ci                    context being created. Only the attribute
6902f4aeb0Sopenharmony_ci                    <constant>EGL_CONTEXT_CLIENT_VERSION</constant> may
7002f4aeb0Sopenharmony_ci                    be specified.
7102f4aeb0Sopenharmony_ci                </para></listitem>
7202f4aeb0Sopenharmony_ci            </varlistentry>
7302f4aeb0Sopenharmony_ci        </variablelist>
7402f4aeb0Sopenharmony_ci    </refsect1>
7502f4aeb0Sopenharmony_ci    <refsect1 id="description"><title>Description</title>
7602f4aeb0Sopenharmony_ci        <para>
7702f4aeb0Sopenharmony_ci            <function>eglCreateContext</function> creates an EGL
7802f4aeb0Sopenharmony_ci            rendering context for the current rendering API (as set with
7902f4aeb0Sopenharmony_ci            <function>eglBindAPI</function>) and returns a handle to the
8002f4aeb0Sopenharmony_ci            context. The context can then be used to render into an EGL
8102f4aeb0Sopenharmony_ci            drawing surface. If <function>eglCreateContext</function>
8202f4aeb0Sopenharmony_ci            fails to create a rendering context,
8302f4aeb0Sopenharmony_ci            <constant>EGL_NO_CONTEXT</constant> is returned.
8402f4aeb0Sopenharmony_ci        </para>
8502f4aeb0Sopenharmony_ci        <para>
8602f4aeb0Sopenharmony_ci            If <parameter>share_context</parameter> is not
8702f4aeb0Sopenharmony_ci            <constant>EGL_NO_CONTEXT</constant>, then all shareable data
8802f4aeb0Sopenharmony_ci            in the context (as defined by the client API specification
8902f4aeb0Sopenharmony_ci            for the current rendering API) are shared by context
9002f4aeb0Sopenharmony_ci            <parameter>share_context</parameter>, all other contexts
9102f4aeb0Sopenharmony_ci            <parameter>share_context</parameter> already shares with,
9202f4aeb0Sopenharmony_ci            and the newly created context. An arbitrary number of
9302f4aeb0Sopenharmony_ci            rendering contexts can share data. However, all rendering
9402f4aeb0Sopenharmony_ci            contexts that share data must themselves exist in the same
9502f4aeb0Sopenharmony_ci            address space. Two rendering contexts share an address space
9602f4aeb0Sopenharmony_ci            if both are owned by a single process.
9702f4aeb0Sopenharmony_ci        </para>
9802f4aeb0Sopenharmony_ci        <para>
9902f4aeb0Sopenharmony_ci            <parameter>attrib_list</parameter> specifies a list of
10002f4aeb0Sopenharmony_ci            attributes for the context. The list has the same structure
10102f4aeb0Sopenharmony_ci            as described for <function>eglChooseConfig</function>. The
10202f4aeb0Sopenharmony_ci            attributes and attribute values which may be specified are
10302f4aeb0Sopenharmony_ci            as follows:
10402f4aeb0Sopenharmony_ci        </para>
10502f4aeb0Sopenharmony_ci        <variablelist>
10602f4aeb0Sopenharmony_ci            <varlistentry>
10702f4aeb0Sopenharmony_ci                <term><constant>EGL_CONTEXT_CLIENT_VERSION</constant></term>
10802f4aeb0Sopenharmony_ci                <listitem><para>
10902f4aeb0Sopenharmony_ci                    Must be followed by an integer that determines which
11002f4aeb0Sopenharmony_ci                    version of an OpenGL ES context to create. A value
11102f4aeb0Sopenharmony_ci                    of 1 specifies creation of an OpenGL ES 1.x context.
11202f4aeb0Sopenharmony_ci                    An attribute value of 2 specifies creation of an
11302f4aeb0Sopenharmony_ci                    OpenGL ES 2.x context. The default value is 1. This
11402f4aeb0Sopenharmony_ci                    attribute can only be specified when creating a
11502f4aeb0Sopenharmony_ci                    OpenGL ES context (e.g. when the current rendering
11602f4aeb0Sopenharmony_ci                    API is <constant>EGL_OPENGL_ES_API</constant>).
11702f4aeb0Sopenharmony_ci                </para></listitem>
11802f4aeb0Sopenharmony_ci            </varlistentry>
11902f4aeb0Sopenharmony_ci        </variablelist>
12002f4aeb0Sopenharmony_ci    </refsect1>
12102f4aeb0Sopenharmony_ci    <refsect1 id="notes"><title>Notes</title>
12202f4aeb0Sopenharmony_ci        <para>
12302f4aeb0Sopenharmony_ci            The current rendering API is only respected if the EGL
12402f4aeb0Sopenharmony_ci            version is 1.2 or greater. Otherwise, an OpenGL ES context
12502f4aeb0Sopenharmony_ci            will always be created.
12602f4aeb0Sopenharmony_ci        </para>
12702f4aeb0Sopenharmony_ci        <para>
12802f4aeb0Sopenharmony_ci            The <constant>EGL_CONTEXT_CLIENT_VERSION</constant>
12902f4aeb0Sopenharmony_ci            attribute is only supported if the EGL version is 1.3 or
13002f4aeb0Sopenharmony_ci            greater.
13102f4aeb0Sopenharmony_ci        </para>
13202f4aeb0Sopenharmony_ci        <para>
13302f4aeb0Sopenharmony_ci            A <firstterm>process</firstterm> is a single execution environment,
13402f4aeb0Sopenharmony_ci            implemented in a single address space, consisting of one or more threads.
13502f4aeb0Sopenharmony_ci        </para>
13602f4aeb0Sopenharmony_ci        <para>
13702f4aeb0Sopenharmony_ci            A <firstterm>thread</firstterm> is one of a set of subprocesses that
13802f4aeb0Sopenharmony_ci            share a single address space, but maintain separate program counters,
13902f4aeb0Sopenharmony_ci            stack spaces, and other related global data.
14002f4aeb0Sopenharmony_ci            A thread is the only member of its subprocess group is equivalent to a
14102f4aeb0Sopenharmony_ci            process.
14202f4aeb0Sopenharmony_ci        </para>
14302f4aeb0Sopenharmony_ci    </refsect1>
14402f4aeb0Sopenharmony_ci    <refsect1 id="errors"><title>Errors</title>
14502f4aeb0Sopenharmony_ci        <para>
14602f4aeb0Sopenharmony_ci            <constant>EGL_NO_CONTEXT</constant> is returned if creation of
14702f4aeb0Sopenharmony_ci            the context fails.
14802f4aeb0Sopenharmony_ci        </para>
14902f4aeb0Sopenharmony_ci        <para>
15002f4aeb0Sopenharmony_ci            <constant>EGL_BAD_MATCH</constant> is generated if the
15102f4aeb0Sopenharmony_ci            current rendering API is <constant>EGL_NONE</constant> (this
15202f4aeb0Sopenharmony_ci            can only arise in an EGL implementation which does not
15302f4aeb0Sopenharmony_ci            support OpenGL ES, prior to the first call to
15402f4aeb0Sopenharmony_ci            <function>eglBindAPI</function>).
15502f4aeb0Sopenharmony_ci        </para>
15602f4aeb0Sopenharmony_ci        <para>
15702f4aeb0Sopenharmony_ci            <constant>EGL_BAD_MATCH</constant> is generated if the
15802f4aeb0Sopenharmony_ci            server context state for
15902f4aeb0Sopenharmony_ci            <parameter>share_context</parameter> exists in an address
16002f4aeb0Sopenharmony_ci            space which cannot be shared with the newly created context,
16102f4aeb0Sopenharmony_ci            if <parameter>share_context</parameter> was created on a
16202f4aeb0Sopenharmony_ci            different display than the one referenced by
16302f4aeb0Sopenharmony_ci            <parameter>config</parameter>, or if the contexts are
16402f4aeb0Sopenharmony_ci            otherwise incompatible.
16502f4aeb0Sopenharmony_ci        </para>
16602f4aeb0Sopenharmony_ci        <para>
16702f4aeb0Sopenharmony_ci            <constant>EGL_BAD_DISPLAY</constant> is generated if
16802f4aeb0Sopenharmony_ci            <parameter>display</parameter> is not an EGL display connection.
16902f4aeb0Sopenharmony_ci        </para>
17002f4aeb0Sopenharmony_ci        <para>
17102f4aeb0Sopenharmony_ci            <constant>EGL_NOT_INITIALIZED</constant> is generated if
17202f4aeb0Sopenharmony_ci            <parameter>display</parameter> has not been initialized.
17302f4aeb0Sopenharmony_ci        </para>
17402f4aeb0Sopenharmony_ci        <para>
17502f4aeb0Sopenharmony_ci            <constant>EGL_BAD_CONFIG</constant> is generated if
17602f4aeb0Sopenharmony_ci            <parameter>config</parameter> is not an EGL frame buffer
17702f4aeb0Sopenharmony_ci            configuration, or does not support the current rendering
17802f4aeb0Sopenharmony_ci            API. This includes requesting creation of an OpenGL ES 1.x
17902f4aeb0Sopenharmony_ci            context when the <constant>EGL_RENDERABLE_TYPE</constant>
18002f4aeb0Sopenharmony_ci            attribute of <parameter>config</parameter> does not contain
18102f4aeb0Sopenharmony_ci            <constant>EGL_OPENGL_ES_BIT</constant>, or creation of an
18202f4aeb0Sopenharmony_ci            OpenGL ES 2.x context when the attribute does not contain
18302f4aeb0Sopenharmony_ci            <constant>EGL_OPENGL_ES2_BIT</constant>.
18402f4aeb0Sopenharmony_ci        </para>
18502f4aeb0Sopenharmony_ci        <para>
18602f4aeb0Sopenharmony_ci            <constant>EGL_BAD_CONTEXT</constant> is generated if
18702f4aeb0Sopenharmony_ci            <parameter>share_context</parameter> is not an EGL rendering
18802f4aeb0Sopenharmony_ci            context of the same client API type as the newly created
18902f4aeb0Sopenharmony_ci            context and is not <constant>EGL_NO_CONTEXT</constant>.
19002f4aeb0Sopenharmony_ci        </para>
19102f4aeb0Sopenharmony_ci        <para>
19202f4aeb0Sopenharmony_ci            <constant>EGL_BAD_ATTRIBUTE</constant> is generated if
19302f4aeb0Sopenharmony_ci            <parameter>attrib_list</parameter> contains an invalid
19402f4aeb0Sopenharmony_ci            context attribute or if an attribute is not recognized or
19502f4aeb0Sopenharmony_ci            out of range. Note that attribute
19602f4aeb0Sopenharmony_ci            <constant>EGL_CONTEXT_CLIENT_VERSION</constant> is
19702f4aeb0Sopenharmony_ci            only valid when the current rendering API is
19802f4aeb0Sopenharmony_ci            <constant>EGL_OPENGL_ES_API</constant>.
19902f4aeb0Sopenharmony_ci        </para>
20002f4aeb0Sopenharmony_ci        <para>
20102f4aeb0Sopenharmony_ci            <constant>EGL_BAD_ALLOC</constant> is generated if there are not
20202f4aeb0Sopenharmony_ci            enough resources to allocate the new context.
20302f4aeb0Sopenharmony_ci        </para>
20402f4aeb0Sopenharmony_ci    </refsect1>
20502f4aeb0Sopenharmony_ci    <refsect1 id="seealso"><title>See Also</title>
20602f4aeb0Sopenharmony_ci        <para>
20702f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglDestroyContext</refentrytitle></citerefentry>,
20802f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglChooseConfig</refentrytitle></citerefentry>,
20902f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglGetConfigs</refentrytitle></citerefentry>,
21002f4aeb0Sopenharmony_ci            <citerefentry><refentrytitle>eglMakeCurrent</refentrytitle></citerefentry>
21102f4aeb0Sopenharmony_ci        </para>
21202f4aeb0Sopenharmony_ci    </refsect1>
21302f4aeb0Sopenharmony_ci    <refsect3 id="Copyright"><title></title>
21402f4aeb0Sopenharmony_ci        <!-- Content included from copyright.inc.xsl -->
21502f4aeb0Sopenharmony_ci        <imageobject>
21602f4aeb0Sopenharmony_ci                <imagedata fileref="KhronosLogo.jpg" format="jpg" />
21702f4aeb0Sopenharmony_ci        </imageobject>
21802f4aeb0Sopenharmony_ci        <para />
21902f4aeb0Sopenharmony_ci    </refsect3>
22002f4aeb0Sopenharmony_ci</refentry>
221