xogl

Minimal OpenGL loader for X11.

MIT License

Stars
23

XOGL

Minimal OpenGL loader for X11.

XOGL consists of three functions:

  • xogl_init(): Initialize an OpenGL context and load OpenGL functions.
  • xogl_swapBuffers(): Swap front and backbuffers. Use after finished drawing.
  • xogl_destroy(): Destroy the OpenGL context.

Basic usage:

    Display* disp = XOpenDisplay(NULL);
    Window win = XCreateSimpleWindow(disp, DefaultRootWindow(disp), 20, 20, 1024, 1024, 0, 0, 0);
    XMapWindow(disp, win);

    // Attempt to initialize an OpenGL 4.5 context
    if (xogl_init(disp, win, 4, 5)) {
        fprintf(stderr, "Unable initialize OpenGL!\n");
        return 1;
    }

    // OpenGL function calls

    while(1) {
        if (!running) {
            break;
        }

        // OpenGL function calls

        xogl_swapBuffers();
    }

    xogl_destroy();