Graphics Reference
In-Depth Information
To create a context, use the following function:
EGLContext eglCreateContext (EGLDisplay display ,
EGLConfig config ,
EGLContext shareContext ,
const EGLint * attribList )
display specifies the EGL display connection
config specifies the configuration
shareContext allows multiple EGL contexts to share specific types of
data, such as shader programs and texture maps; use
EGL_NO_CONTEXT for no sharing
specifies the list of attributes for the context to be
created; only a single attribute is accepted,
EGL_CONTEXT_CLIENT_VERSION
attribList
Once again, you will need the display connection and the EGLConfig
that best represents your application's requirements. The third parameter,
shareContext , allows multiple EGLContext s to share specific types of
data, such as shader programs and texture maps. For the time being, we
pass EGL_NO_CONTEXT in as the value for shareContext , indicating that
we are not sharing resources with any other contexts.
Finally, as with many EGL calls, a list of attributes specific to eglCreate-
Context is operation is specified. In this case, a single attribute is accepted,
EGL_CONTEXT_CLIENT_VERSION , which is discussed in Table 3-6.
Table 3-6
Attributes for Context Creation Using eglCreateContext
Token
Description
Default Value
EGL_CONTEXT_
CLIENT_VERSION
Specifies the type of
context associated with
the version of OpenGL
ES that you are using
1 (specifies an OpenGL ES
1.X context)
Because we want to use OpenGL ES 3.0, we will always have to specify this
attribute to obtain the right type of context.
When eglCreateContext succeeds, it returns a handle to the newly
created context. If a context cannot be created, then eglCreateContext
returns EGL_NO_CONTEXT , and the reason for the failure is set and can be
obtained by calling eglGetError . With our current knowledge, the only
 
 
Search WWH ::




Custom Search