blob: 3a0531452ebcaa1fea567b989837cd148f688ee0 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
<refentry xml:base="" id="eglCreateContext">
<holder>The Khronos Group Inc.</holder>
create a new <acronym>EGL</acronym> rendering context
<title>C Specification</title>
<funcdef>EGLContext <function>eglCreateContext</function></funcdef>
<paramdef>EGLDisplay <parameter>display</parameter></paramdef>
<paramdef>EGLConfig <parameter>config</parameter></paramdef>
<paramdef>EGLContext <parameter>share_context</parameter></paramdef>
<paramdef>EGLint const * <parameter>attrib_list</parameter></paramdef>
<refsect1 id="parameters"><title>Parameters</title>
Specifies the
display connection.
<listitem><para>Specifies the EGL frame buffer configuration that
defines the frame buffer resource available to the rendering context.
Specifies another
rendering context with which to share data, as
defined by the client API corresponding to the
contexts. Data is also shared with all other
contexts with which
<parameter>share_context</parameter> shares data.
<constant>EGL_NO_CONTEXT</constant> indicates that
no sharing is to take place.
Specifies attributes and attribute values for the
context being created. Only the attribute
<constant>EGL_CONTEXT_CLIENT_VERSION</constant> may
be specified.
<refsect1 id="description"><title>Description</title>
<function>eglCreateContext</function> creates an EGL
rendering context for the current rendering API (as set with
<function>eglBindAPI</function>) and returns a handle to the
context. The context can then be used to render into an EGL
drawing surface. If <function>eglCreateContext</function>
fails to create a rendering context,
<constant>EGL_NO_CONTEXT</constant> is returned.
If <parameter>share_context</parameter> is not
<constant>EGL_NO_CONTEXT</constant>, then all shareable data
in the context (as defined by the client API specification
for the current rendering API) are shared by context
<parameter>share_context</parameter>, all other contexts
<parameter>share_context</parameter> already shares with,
and the newly created context. An arbitrary number of
rendering contexts can share data. However, all rendering
contexts that share data must themselves exist in the same
address space. Two rendering contexts share an address space
if both are owned by a single process.
<parameter>attrib_list</parameter> specifies a list of
attributes for the context. The list has the same structure
as described for <function>eglChooseConfig</function>. The
attributes and attribute values which may be specified are
as follows:
Must be followed by an integer that determines which
version of an OpenGL ES context to create. A value
of 1 specifies creation of an OpenGL ES 1.x context.
An attribute value of 2 specifies creation of an
OpenGL ES 2.x context. The default value is 1. This
attribute can only be specified when creating a
OpenGL ES context (e.g. when the current rendering
API is <constant>EGL_OPENGL_ES_API</constant>).
<refsect1 id="notes"><title>Notes</title>
The current rendering API is only respected if the EGL
version is 1.2 or greater. Otherwise, an OpenGL ES context
will always be created.
The <constant>EGL_CONTEXT_CLIENT_VERSION</constant>
attribute is only supported if the EGL version is 1.3 or
A <firstterm>process</firstterm> is a single execution environment,
implemented in a single address space, consisting of one or more threads.
A <firstterm>thread</firstterm> is one of a set of subprocesses that
share a single address space, but maintain separate program counters,
stack spaces, and other related global data.
A thread is the only member of its subprocess group is equivalent to a
<refsect1 id="errors"><title>Errors</title>
<constant>EGL_NO_CONTEXT</constant> is returned if creation of
the context fails.
<constant>EGL_BAD_MATCH</constant> is generated if the
current rendering API is <constant>EGL_NONE</constant> (this
can only arise in an EGL implementation which does not
support OpenGL ES, prior to the first call to
<constant>EGL_BAD_MATCH</constant> is generated if the
server context state for
<parameter>share_context</parameter> exists in an address
space which cannot be shared with the newly created context,
if <parameter>share_context</parameter> was created on a
different display than the one referenced by
<parameter>config</parameter>, or if the contexts are
otherwise incompatible.
<constant>EGL_BAD_DISPLAY</constant> is generated if
<parameter>display</parameter> is not an EGL display connection.
<constant>EGL_NOT_INITIALIZED</constant> is generated if
<parameter>display</parameter> has not been initialized.
<constant>EGL_BAD_CONFIG</constant> is generated if
<parameter>config</parameter> is not an EGL frame buffer
configuration, or does not support the current rendering
API. This includes requesting creation of an OpenGL ES 1.x
context when the <constant>EGL_RENDERABLE_TYPE</constant>
attribute of <parameter>config</parameter> does not contain
<constant>EGL_OPENGL_ES_BIT</constant>, or creation of an
OpenGL ES 2.x context when the attribute does not contain
<constant>EGL_BAD_CONTEXT</constant> is generated if
<parameter>share_context</parameter> is not an EGL rendering
context of the same client API type as the newly created
context and is not <constant>EGL_NO_CONTEXT</constant>.
<constant>EGL_BAD_ATTRIBUTE</constant> is generated if
<parameter>attrib_list</parameter> contains an invalid
context attribute or if an attribute is not recognized or
out of range. Note that attribute
<constant>EGL_CONTEXT_CLIENT_VERSION</constant> is
only valid when the current rendering API is
<constant>EGL_BAD_ALLOC</constant> is generated if there are not
enough resources to allocate the new context.
<refsect1 id="seealso"><title>See Also</title>
<refsect3 id="Copyright"><title></title>
<!-- Content included from -->
<imagedata fileref="KhronosLogo.jpg" format="jpg" />
<para />