Home

WGL

WGL, or Windows Graphics Library, is the OpenGL interface for the Windows operating system. It provides the set of functions that allow applications to create and manage OpenGL rendering contexts, select pixel formats, and load OpenGL extensions on Windows. WGL is part of the Windows platform SDK and serves as the Windows-specific counterpart to GLX on Unix-like systems.

Core concepts in WGL include the device context (HDC) and the rendering context (HGLRC). An application obtains

Extensions and extension loading are central to WGL. Extensions add functionality such as enhanced pixel format

History and scope: WGL evolved with OpenGL and Windows drivers to support newer graphics features and contexts.

See also: OpenGL, GLX, EGL, Windows API, HDC, HGLRC, wglCreateContext, wglMakeCurrent, wglGetProcAddress.

an
HDC
for
a
window,
chooses
a
suitable
pixel
format,
creates
an
OpenGL
rendering
context
with
wglCreateContext,
and
makes
it
current
with
wglMakeCurrent.
Rendering
then
occurs
through
OpenGL.
For
modern
OpenGL,
developers
often
create
a
context
with
specific
version
and
profile
attributes
using
wglCreateContextAttribsARB,
a
function
obtained
via
the
WGL
extension
mechanism.
selection
and
advanced
context
creation.
Extension
entry
points
are
retrieved
at
runtime
using
wglGetProcAddress.
A
common
pattern
is
to
create
a
temporary
context
to
obtain
addresses
for
extension
functions,
then
create
a
final
context
with
the
desired
attributes.
It
remains
Windows-only,
with
cross-platform
development
typically
using
GLX
on
X11
or
EGL
for
embedded/desktop
environments.
Developers
must
manage
the
lifecycle
of
HDCs
and
HGLRCs
and
account
for
variations
in
extension
availability
across
driver
versions
and
Windows
updates.