C Specification
The XrGraphicsBindingOpenGLWin32KHR structure is defined as:
// Provided by XR_KHR_opengl_enable
typedef struct XrGraphicsBindingOpenGLWin32KHR {
XrStructureType type;
const void* next;
HDC hDC;
HGLRC hGLRC;
} XrGraphicsBindingOpenGLWin32KHR;
Members
Description
To create an OpenGL-backed XrSession on Microsoft Windows, the
application provides a pointer to an XrGraphicsBindingOpenGLWin32KHR
structure in the XrSessionCreateInfo::next chain when calling
xrCreateSession.
As no standardized way exists for OpenGL to create the graphics context on a
specific GPU, the runtime must assume that the application uses the
operating system’s default GPU when this structure is supplied.
If the GPU used by the runtime does not match the GPU on which the OpenGL
context of the application was created, xrCreateSession must return
XR_ERROR_GRAPHICS_DEVICE_INVALID.
Creating a session using this structure triggers several requirements on the runtime regarding swapchain images. See the specification of XrSwapchainImageOpenGLKHR for details.
By providing a context as hGLRC, the application becomes subject to
restrictions on use of that context which effectively introduces additional
external synchronization requirements on some OpenXR calls.
See https://registry.khronos.org/OpenXR/specs/1.1/html/xrspec.html#khr_opengl_enable-threading for details.
The required window system configuration define to expose this structure type is XR_USE_PLATFORM_WIN32.
See Also
Document Notes
For more information, see the OpenXR Specification
This page is extracted from the OpenXR Specification. Fixes and changes should be made to the Specification, not directly.
Copyright
Copyright 2014-2025 The Khronos Group Inc.
This work is licensed under a Creative Commons Attribution 4.0 International License.