Graphics Reference
In-Depth Information
This function takes as arguments our connection to the native
display manager and the
EGLConfig
that we obtained in the previous
step. Additionally, it requires a window from the native windowing
system that was created previously. Because EGL is a software layer
between many different windowing systems and OpenGL ES 3.0,
demonstrating how to create a native window is outside the scope
of this guide. Please refer to the documentation for your native
windowing system to determine what is required to create a window
in that environment.
Finally, this call takes a list of attributes; however, this list differs
from the attributes shown in Table 3-1. Because EGL supports other
rendering APIs (notably OpenVG), some attributes accepted by
eglCreateWindowSurface
do not apply when working with OpenGL ES
3.0 (see Table 3-2). For our purposes,
eglCreateWindowSurface
accepts a
single attribute, which is used to specify the buffer of the front- or back-
buffer we would like to render into.
Table 3-2
Attributes for Window Creation Using
eglCreateWindowSurface
Token
Description
Default Value
EGL_RENDER_BUFFER
EGL_BACK_BUFFER
Specifies which buffer
should be used for
rendering (using the
EGL_SINGLE_BUFFER
value), or back
(
EGL_BACK_BUFFER
)
Note:
For OpenGL ES 3.0 window rendering surfaces, only double-
buffered windows are supported.
The attribute list might be empty (i.e., passing a
NULL
pointer as the value
for
attribList
), or it might be a list populated with an
EGL_NONE
token
as the first element. In such cases, all of the relevant attributes use their
default values.
There are a number of ways in which
eglCreateWindowSurface
could
fail, and if any of them occur,
EGL_NO_SURFACE
is returned from the call
and the particular error is set. If this situation occurs, we can determine
the reason for the failure by calling
eglGetError
, which will return one
of the reasons shown in Table 3-3.