Skip to content

Modern OpenGL

Finalspace edited this page May 29, 2026 · 2 revisions

Table of Contents

Initialize a modern OpenGL Rendering Context

To initialize a modern OpenGL (3.0+) rendering context, you simply set the fplInitFlags_Video flag in the fplPlatformInit() call and change the video backend type to fplVideoBackendType_OpenGL and setup the following parameters:

 settings;
(&settings);
 &videoSettings = settings.;

// Forcing the video backend to be modern OpenGL with Core profile and for GL version 3.3
videoSettings. = ;
videoSettings... = ;
videoSettings... = 3;
videoSettings... = 3;

if ((, &settings)) {
    // ... modern context is ready
}

Usage

Extensions loader

To use modern OpenGL, you need some sort of an OpenGL extension loader which gives you access to the constants and functions like glCreateProgram().

You can either use a third-party C/C++ Library for doing that for you or use/write your own OpenGL loader. FPL should work in both ways.

List of tested OpenGL loaders:

Presenting your frame

Call fplVideoFlip() to present the frame to the screen.

It is recommended to call this after each draw call of your frame at the end of the main-loop.

Multisample anti-aliasing (MSAA)

In a modern OpenGL context, you can activate multi-sampling-antialiasing (MSAA) to get smooth edges with few performance costs out-of-the-box.

By default, multisampling is disabled. To enable it, you simply set your desired multi-sampling count in fplOpenGLSettings::multiSamplingCount .

 settings;
(&settings);
 &videoSettings = settings.;

// Forcing the video backend to be modern OpenGL with Core profile and for GL version 3.3
videoSettings. = ;
videoSettings... = ;
videoSettings... = 3;
videoSettings... = 3;

// Use 4x MSAA
videoSettings.opengl.multiSamplingCount = 4;

if ((, &settings)) {
    // ... modern context is ready
}

Notes

FPL does not provide any OpenGL types, prototypes, or functions - it's fully up to the caller how to handle this.

Keep in mind that FPL does not work with platform abstraction libraries like GLFW or GLUT, but GLEW for example will work just fine.

Final Platform Layer

Pages

Topics

Data Structures

Clone this wiki locally