• 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="eglCreateContext">
5    <refentryinfo>
6         <copyright>
7             <year>2003-2014</year>
8             <holder>The Khronos Group Inc.</holder>
9         </copyright>
10    </refentryinfo>
11    <refmeta>
12        <refentrytitle>eglCreateContext</refentrytitle>
13        <manvolnum>3G</manvolnum>
14    </refmeta>
15    <refnamediv>
16        <refname>eglCreateContext</refname>
17        <refpurpose>
18            create a new <acronym>EGL</acronym> rendering context
19        </refpurpose>
20    </refnamediv>
21    <refsynopsisdiv>
22        <title>C Specification</title>
23        <funcsynopsis>
24            <funcprototype>
25                <funcdef>EGLContext <function>eglCreateContext</function></funcdef>
26                <paramdef>EGLDisplay <parameter>display</parameter></paramdef>
27                <paramdef>EGLConfig <parameter>config</parameter></paramdef>
28                <paramdef>EGLContext <parameter>share_context</parameter></paramdef>
29                <paramdef>EGLint const * <parameter>attrib_list</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><para>
38                    Specifies the
39                    <acronym>EGL</acronym>
40                    display connection.
41                </para></listitem>
42            </varlistentry>
43            <varlistentry>
44                <term><parameter>config</parameter></term>
45                <listitem><para>Specifies the EGL frame buffer configuration that
46                    defines the frame buffer resource available to the rendering context.
47                </para></listitem>
48            </varlistentry>
49            <varlistentry>
50                <term><parameter>share_context</parameter></term>
51                <listitem><para>
52                    Specifies another
53                    <acronym>EGL</acronym>
54                    rendering context with which to share data, as
55                    defined by the client API corresponding to the
56                    contexts. Data is also shared with all other
57                    contexts with which
58                    <parameter>share_context</parameter> shares data.
59                    <constant>EGL_NO_CONTEXT</constant> indicates that
60                    no sharing is to take place.
61                </para>
62                </listitem>
63            </varlistentry>
64            <varlistentry>
65                <term><parameter>attrib_list</parameter></term>
66                <listitem><para>
67                    Specifies attributes and attribute values for the
68                    context being created. Only the attribute
69                    <constant>EGL_CONTEXT_CLIENT_VERSION</constant> may
70                    be specified.
71                </para></listitem>
72            </varlistentry>
73        </variablelist>
74    </refsect1>
75    <refsect1 id="description"><title>Description</title>
76        <para>
77            <function>eglCreateContext</function> creates an EGL
78            rendering context for the current rendering API (as set with
79            <function>eglBindAPI</function>) and returns a handle to the
80            context. The context can then be used to render into an EGL
81            drawing surface. If <function>eglCreateContext</function>
82            fails to create a rendering context,
83            <constant>EGL_NO_CONTEXT</constant> is returned.
84        </para>
85        <para>
86            If <parameter>share_context</parameter> is not
87            <constant>EGL_NO_CONTEXT</constant>, then all shareable data
88            in the context (as defined by the client API specification
89            for the current rendering API) are shared by context
90            <parameter>share_context</parameter>, all other contexts
91            <parameter>share_context</parameter> already shares with,
92            and the newly created context. An arbitrary number of
93            rendering contexts can share data. However, all rendering
94            contexts that share data must themselves exist in the same
95            address space. Two rendering contexts share an address space
96            if both are owned by a single process.
97        </para>
98        <para>
99            <parameter>attrib_list</parameter> specifies a list of
100            attributes for the context. The list has the same structure
101            as described for <function>eglChooseConfig</function>. The
102            attributes and attribute values which may be specified are
103            as follows:
104        </para>
105        <variablelist>
106            <varlistentry>
107                <term><constant>EGL_CONTEXT_CLIENT_VERSION</constant></term>
108                <listitem><para>
109                    Must be followed by an integer that determines which
110                    version of an OpenGL ES context to create. A value
111                    of 1 specifies creation of an OpenGL ES 1.x context.
112                    An attribute value of 2 specifies creation of an
113                    OpenGL ES 2.x context. The default value is 1. This
114                    attribute can only be specified when creating a
115                    OpenGL ES context (e.g. when the current rendering
116                    API is <constant>EGL_OPENGL_ES_API</constant>).
117                </para></listitem>
118            </varlistentry>
119        </variablelist>
120    </refsect1>
121    <refsect1 id="notes"><title>Notes</title>
122        <para>
123            The current rendering API is only respected if the EGL
124            version is 1.2 or greater. Otherwise, an OpenGL ES context
125            will always be created.
126        </para>
127        <para>
128            The <constant>EGL_CONTEXT_CLIENT_VERSION</constant>
129            attribute is only supported if the EGL version is 1.3 or
130            greater.
131        </para>
132        <para>
133            A <firstterm>process</firstterm> is a single execution environment,
134            implemented in a single address space, consisting of one or more threads.
135        </para>
136        <para>
137            A <firstterm>thread</firstterm> is one of a set of subprocesses that
138            share a single address space, but maintain separate program counters,
139            stack spaces, and other related global data.
140            A thread is the only member of its subprocess group is equivalent to a
141            process.
142        </para>
143    </refsect1>
144    <refsect1 id="errors"><title>Errors</title>
145        <para>
146            <constant>EGL_NO_CONTEXT</constant> is returned if creation of
147            the context fails.
148        </para>
149        <para>
150            <constant>EGL_BAD_MATCH</constant> is generated if the
151            current rendering API is <constant>EGL_NONE</constant> (this
152            can only arise in an EGL implementation which does not
153            support OpenGL ES, prior to the first call to
154            <function>eglBindAPI</function>).
155        </para>
156        <para>
157            <constant>EGL_BAD_MATCH</constant> is generated if the
158            server context state for
159            <parameter>share_context</parameter> exists in an address
160            space which cannot be shared with the newly created context,
161            if <parameter>share_context</parameter> was created on a
162            different display than the one referenced by
163            <parameter>config</parameter>, or if the contexts are
164            otherwise incompatible.
165        </para>
166        <para>
167            <constant>EGL_BAD_DISPLAY</constant> is generated if
168            <parameter>display</parameter> is not an EGL display connection.
169        </para>
170        <para>
171            <constant>EGL_NOT_INITIALIZED</constant> is generated if
172            <parameter>display</parameter> has not been initialized.
173        </para>
174        <para>
175            <constant>EGL_BAD_CONFIG</constant> is generated if
176            <parameter>config</parameter> is not an EGL frame buffer
177            configuration, or does not support the current rendering
178            API. This includes requesting creation of an OpenGL ES 1.x
179            context when the <constant>EGL_RENDERABLE_TYPE</constant>
180            attribute of <parameter>config</parameter> does not contain
181            <constant>EGL_OPENGL_ES_BIT</constant>, or creation of an
182            OpenGL ES 2.x context when the attribute does not contain
183            <constant>EGL_OPENGL_ES2_BIT</constant>.
184        </para>
185        <para>
186            <constant>EGL_BAD_CONTEXT</constant> is generated if
187            <parameter>share_context</parameter> is not an EGL rendering
188            context of the same client API type as the newly created
189            context and is not <constant>EGL_NO_CONTEXT</constant>.
190        </para>
191        <para>
192            <constant>EGL_BAD_ATTRIBUTE</constant> is generated if
193            <parameter>attrib_list</parameter> contains an invalid
194            context attribute or if an attribute is not recognized or
195            out of range. Note that attribute
196            <constant>EGL_CONTEXT_CLIENT_VERSION</constant> is
197            only valid when the current rendering API is
198            <constant>EGL_OPENGL_ES_API</constant>.
199        </para>
200        <para>
201            <constant>EGL_BAD_ALLOC</constant> is generated if there are not
202            enough resources to allocate the new context.
203        </para>
204    </refsect1>
205    <refsect1 id="seealso"><title>See Also</title>
206        <para>
207            <citerefentry><refentrytitle>eglDestroyContext</refentrytitle></citerefentry>,
208            <citerefentry><refentrytitle>eglChooseConfig</refentrytitle></citerefentry>,
209            <citerefentry><refentrytitle>eglGetConfigs</refentrytitle></citerefentry>,
210            <citerefentry><refentrytitle>eglMakeCurrent</refentrytitle></citerefentry>
211        </para>
212    </refsect1>
213    <refsect3 id="Copyright"><title></title>
214        <!-- Content included from copyright.inc.xsl -->
215        <imageobject>
216                <imagedata fileref="KhronosLogo.jpg" format="jpg" />
217        </imageobject>
218        <para />
219    </refsect3>
220</refentry>
221