Skip to content

OpenGL Guide

squid233 edited this page Aug 9, 2025 · 4 revisions

Functions

The OpenGL module does not use static but instance methods to invoke functions. An instance is required to be constructed before the methods could be invoked.

To obtain such instance, simply use new.

void main() {
    var gl = new GL(GLFW::glfwGetProcAddress);
}

Debug Callback

OverrunGL provides a convenient method to create debug callback with GLUtil::setupDebugMessageCallback.

GLLoadFunc loadFunc = ...;
GL gl = ...;
var glFlags = new GLFlags(loadFunc);
debugCallbackArena = Arena.ofConfined();
// or global arena
debugCallbackArena = Arena.global();
GLUtil.setupDebugMessageCallback(debugCallbackArena, gl, glFlags, loadFunc);

// you may close the arena after destroying window if you are not using global arena
glfwDestroyWindow(window);
debugCallbackArena.close();

Clone this wiki locally