Graphics Reference
In-Depth Information
EGLNativeDisplayType is defined to match the native window
system's display type. On Microsoft Windows, for example, an
EGLNativeDisplayType would be defined to be an HDC—a handle to
the Microsoft Windows device context. However, to make it easy to move
your code to different operating systems and platforms, the token
EGL_DEFAULT_DISPLAY is accepted and will return a connection to the
default native display, as we did.
If a display connection isn't available, eglGetDisplay will return
EGL_NO_DISPLAY . This error indicates that EGL isn't available, and you
won't be able to use OpenGL ES 3.0.
Before we continue by discussing more EGL operations, we need to briefly
describe how EGL processes and reports errors to your application.
Checking for Errors
Most functions in EGL return EGL_TRUE when successful and EGL_FALSE
otherwise. However, EGL will do more than just tell you if the call
failed—it will record an error to indicate the reason for failure. However,
that error code is not returned to you directly; you need to query EGL
explicitly for the error code, which you can do by calling the following
function:
EGLint eglGetError ()
This function returns the error code of the most recent EGL function
called in a specific thread. If EGL_SUCCESS is returned, then there is no
status to return.
You might wonder why this is a prudent approach, as compared to
directly returning the error code when the call completes. Although
we never encourage anyone to ignore function return codes, allowing
optional error code recovery reduces redundant code in applications
verified to work properly. You should certainly check for errors during
development and debugging, and on an ongoing basis in critical
applications, but once you are convinced your application is working as
expected, you can likely reduce your error checking.
 
 
 
Search WWH ::




Custom Search