2003-2018
The Khronos Group Inc.
eglCreateContext
3G
eglCreateContext
create a new EGL rendering context
C Specification
EGLContext eglCreateContext
EGLDisplay display
EGLConfig config
EGLContext share_context
EGLint const * attrib_list
Parameters
display
Specifies the
EGL
display connection.
config
Specifies the EGL frame buffer configuration that
defines the frame buffer resource available to the rendering context.
share_context
Specifies another
EGL
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
share_context shares data.
EGL_NO_CONTEXT indicates that
no sharing is to take place.
attrib_list
Specifies attributes and attribute values for the
context being created. Only the attribute
EGL_CONTEXT_CLIENT_VERSION may
be specified.
Description
eglCreateContext creates an EGL
rendering context for the current rendering API (as set with
eglBindAPI) and returns a handle to the
context. The context can then be used to render into an EGL
drawing surface. If eglCreateContext
fails to create a rendering context,
EGL_NO_CONTEXT is returned.
If share_context is not
EGL_NO_CONTEXT, then all shareable data
in the context (as defined by the client API specification
for the current rendering API) are shared by context
share_context, all other contexts
share_context 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.
attrib_list specifies a list of
attributes for the context. The list has the same structure
as described for eglChooseConfig. The
attributes and attribute values which may be specified are
as follows:
EGL_CONTEXT_MAJOR_VERSION
Must be followed by an integer specifying the requested
major version of an OpenGL or OpenGL ES context. The
default value is 1. This attribute is an alias of the
older EGL_CONTEXT_CLIENT_VERSION,
and the tokens may be used interchangeably.
EGL_CONTEXT_MINOR_VERSION
Must be followed by an integer specifying the requested
minor version of an OpenGL or OpenGL ES context. The
default value is 0.
EGL_CONTEXT_OPENGL_PROFILE_MASK
Must be followed by an integer bitmask specifying the
profile of an OpenGL context.
Bits which may be set include
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT
for a core profile and
EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT
for a compatibility profile. The default value is
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT.
All OpenGL 3.2 and later implementations are required to
implement the core profile, but implementation of the
compatibility profile is optional.
EGL_CONTEXT_OPENGL_DEBUG
Must be followed by EGL_TRUE,
specifying that an OpenGL or OpenGL ES debug
context should be created, or
EGL_FALSE, if a non-debug context
should be created. The default value is
EGL_FALSE.
EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE
Must be followed by EGL_TRUE,
specifying that a
forward-compatible OpenGL context
should be created, or EGL_FALSE, if
a non-forward-compatible context should be created. The
default value is EGL_FALSE.
EGL_CONTEXT_OPENGL_ROBUST_ACCESS
Must be followed by EGL_TRUE,
specifying that an OpenGL or OpenGL ES context
supporting robust buffer access
should be created, or EGL_FALSE, if
a non-robust context should be created. The default
value is EGL_FALSE.
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY
Must be followed by
EGL_LOSE_CONTEXT_ON_RESET,
specifying that an OpenGL or OpenGL ES context with
reset notification behavior
GL_LOSE_CONTEXT_ON_RESET_ARB should
be created, or
EGL_NO_RESET_NOTIFICATION,
specifying that an OpenGL or OpenGL ES context with
reset notification behavior
GL_NO_RESET_NOTIFICATION_ARB should
be created, as described by the
GL_ARB_robustness extension.
If the
EGL_CONTEXT_OPENGL_ROBUST_ACCESS
attribute is not set to EGL_TRUE,
context creation will not fail, but the resulting
context may not support robust buffer access, and
therefore may not support the requested reset
notification strategy The default value for
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY
is EGL_NO_RESET_NOTIFICATION .
There are many possible interactions between requested OpenGL
and OpenGL ES context creation attributes, depending on the API
versions and extensions supported by the implementation. These
interactions are described in detail in the EGL 1.5
Specification, but are not listed here for compactness. The
requested attributes may not be able to be satisfied, but
context creation may still succeed. Applications should ensure
that the OpenGL or OpenGL ES contexts supports needed features
before using them, by determining the actual context version,
supported extensions, and supported context flags using runtime
queries.