x11
FreeBodyEngine.graphics.gl33.context.x11
#
Native X11/OpenGL context creation using EGL.
This is the X11 counterpart to context/wayland.py and is intended to work with X11Window from window_x11.py.
The window backend owns only X11 windowing/input. This module owns the EGL connection, EGLSurface and EGLContext, exactly like the Wayland EGL context module owns those pieces for the Wayland backend.
Expected X11 window attributes
window.native_display -> X11 Display* as ctypes.c_void_p window.native_window -> X11 Window/XID window.native_visual_id -> X11 visual ID window.size -> (width, height)
On X11, EGL can use the X11 Display* directly, so there is no wl_egl_window wrapper. The X11 Window/XID is passed directly to eglCreateWindowSurface().
EGL_CONTEXT_MAJOR_VERSION = 12440
module-attribute
#
EGL_CONTEXT_MINOR_VERSION = 12539
module-attribute
#
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT = 1
module-attribute
#
EGL_CONTEXT_OPENGL_DEBUG = 12720
module-attribute
#
EGL_CONTEXT_OPENGL_PROFILE_MASK = 12541
module-attribute
#
EGL_NATIVE_VISUAL_ID = 12334
module-attribute
#
create_x11_opengl_context(window, debug)
#
Create an EGL/OpenGL context and window surface for an X11Window.
destroy_x11_opengl_context(window)
#
Destroy the EGL surface/context and terminate the X11 EGL display.
resize_x11_opengl_surface(window, width, height)
#
Record an X11 resize request.
X11 itself applies the resize to the Window. No EGL surface resize call is required; the drawable remains the same X11 Window and eglSwapBuffers will present using its current dimensions.
swap_x11_opengl_buffers(window)
#
Present the current EGL back buffer for the X11 window.