Home

eglGetDisplay

eglGetDisplay is an EGL API function used to obtain an EGLDisplay handle for a given native display. The EGLDisplay object is an opaque handle that is used in subsequent EGL calls to manage rendering contexts, surfaces, and configurations.

Prototype and parameters: EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id); The display_id argument is a platform-dependent native display handle (for

Return value and behavior: The function returns a valid EGLDisplay on success, or EGL_NO_DISPLAY if the requested

Usage pattern: Typical usage is to call eglGetDisplay, then eglInitialize(display, &major, &minor). If initialization succeeds, the

Portability and extensions: Behavior is platform-dependent, and not all native displays may be supported. Some environments

example,
a
X11
Display*,
a
Wayland
wl_display*,
or
another
platform’s
display
handle).
Some
platforms
also
define
EGL_DEFAULT_DISPLAY
to
request
the
default
display.
The
exact
type
of
EGLNativeDisplayType
varies
by
implementation.
display
cannot
be
provided.
Importantly,
eglGetDisplay
does
not
initialize
EGL
itself;
it
merely
resolves
a
display
object
for
the
given
native
display.
After
obtaining
a
display,
you
must
call
eglInitialize
to
initialize
EGL
for
that
display
and
retrieve
the
major
and
minor
version
numbers.
display
handle
is
used
with
subsequent
EGL
calls
such
as
eglChooseConfig,
eglCreateContext,
and
eglCreateWindowSurface.
If
eglGetDisplay
returns
EGL_NO_DISPLAY,
or
eglInitialize
fails
(EGL_FALSE),
you
should
query
the
error
with
eglGetError.
provide
alternative
ways
to
obtain
a
display
(for
example,
via
eglGetPlatformDisplayEXT
or
eglGetPlatformDisplay
in
EGL
1.5).