Skip to content

LWJGL 3 backend

joid-backend-lwjgl3 runs JOID on LWJGL 3 with a GLFW window and an OpenGL context. It is the reference backend: the other backends compare their renders with its own (Testing a backend). How an application installs and starts it is on Choosing a backend.

BridgeClassFrom
RenderGlRenderBridge over Lwjgl3GlBindingbase-opengl, base-lwjgl3-opengl
AudioAlAudioBridge over Lwjgl3AlBindingbase-openal, base-lwjgl3-openal
WindowGlfwWindowBridgebase-lwjgl3-glfw
InputGlfwInputForwarder, attached in attachInput()base-lwjgl3-glfw

Its own code is small: Lwjgl3Backend and GlContextRequest.

Lwjgl3Backend.binding takes another IGlBinding than Lwjgl3GlBinding.inst(). The snapshot backend uses it to hide extensions from the render bridge (ProfileGlBinding); a host can use it to route the OpenGL calls through its own layer.

GlContextRequest sets the GLFW hints of the context before the window exists; Start a backend gives its three requests. On macOS, CORE_33 also asks for a forward-compatible context, which macOS requires.

The render bridge adapts to the context: dialect, framebuffer family, vertex arrays, mipmap copies (base-opengl). Lwjgl3SnapshotBackend renders on the SnapshotProfile named by the system property joid.snapshot.profile, so that a test run checks one path:

ProfileContext
DEFAULTOpenGL 3.3 core requested, whatever version the driver gives.
GL_20OpenGL 2.0 with GLSL 1.10, which JOID must refuse with a clear message.
GL_21OpenGL 2.1.
GL_21_EXTOpenGL 2.1 without the ARB framebuffer and vertex array extensions: the EXT framebuffer family.
GL_21_EXT_NO_BLITThe same without framebuffer blits: mipmaps are drawn.
GL_30OpenGL 3.0.
GL_32_FORWARD_COMPATIBLEOpenGL 3.2 core, forward-compatible.
GL_33OpenGL 3.3 core.
GL_45_COMPATIBILITYOpenGL 4.5 compatibility.

Every profile but DEFAULT checks the version and the profile that the driver gives; a driver that cannot give them fails the test with a message that suggests MESA_GL_VERSION_OVERRIDE and MESA_GLSL_VERSION_OVERRIDE.

Lwjgl3SnapshotBackend opens a hidden GLFW window with the request of the profile, turns vertical sync off and registers the backend with audio(false). Testing a backend runs the contract suites and the snapshot suite on your backend.

Report a problem with this page