Final Platform Layer  0.9.6-beta
Initialization & Overview

Initialize a video context

To initialize either software or hardware video output, you have to set the fplInitFlags_Video flag in the fplPlatformInit() call and ensure that video is not disabled by a preprocessor directive FPL_NO_VIDEO.

Also setting the fplInitFlags_Video flag ensures that the fplInitFlags_Window flag is appended automatically.

Default video output

If you don't specify any settings then the video backend is automatically detected, depending on your operating system and supported hardware and software.
By default, this is most likely be legacy OpenGL - which is supported on almost every video card on any OS.

But this is not the recommended way to initialize video output, because you are responsible for handling any video output yourself.

// ... your code here

Setting the video backend

It is recommended to set at least the video backend manually, to ensure that you get either initialized with that backend properly or an error when your configuration is not supported.

You do that by simply setting the fplVideoBackendType field in your fplVideoSettings structure which is included in the fplSettings structure to the fplPlatformInit() call.

fplSettings settings;
fplVideoSettings &videoSettings =;
// Forcing the video backend to be OpenGL
// ... your code here

Enable/Disable Vertical Synchronisation

If you want to enable/disable vertical synchronization you simply set the fplVideoSettings.isVSync field respectively.

There is no guarantee that vertical synchronization is supported by your video device or selected backend.
Software video output does not support vertical synchronisation!

Disable unneeded video backends

To compile out certain video backends, you simply specify the FPL_NO_VIDEO_[Name of the video backend] preprocessor directive.
But the fplVideoBackendType in question is never removed from the enumeration - keep that in mind!

Example (Disable OpenGL video backend):

#include <final_platform_layer.h>

Disable all Video Output

To compile out all video output code you define the FPL_NO_VIDEO preprocessor directive.

#define FPL_NO_VIDEO
#include <final_platform_layer.h>
Keep in mind that this is not useful for window-based applications!
If you writing a console application and don't want any video output whatsoever you set the FPL_NO_WINDOW which automatically disables any video devices as well.


Backend types stored in the fplVideoBackendType enumeration are not filtered away, even when you disable it by a preprocessor directive!
Keep that in mind when you initialize the video backend.

If needed you can use fplSetDefaultVideoSettings() to fill in just the default video settings inside the fplVideoSettings structure.

A structure containing settings, such as window, video, etc.
Definition: final_platform_layer.h:3930
Definition: final_platform_layer.h:3452
fplVideoBackendType backend
video backend type
Definition: final_platform_layer.h:3565
fpl_common_api bool fplPlatformInit(const fplInitFlags initFlags, const fplSettings *initSettings)
Initializes the platform layer.
fplVideoSettings video
Video settings.
Definition: final_platform_layer.h:3934
Use a video backbuffer (This flag ensures that fplInitFlags_Window is included always)
Definition: final_platform_layer.h:3384
A structure that contains video settings such as backend, v-sync, API-settings, etc.
Definition: final_platform_layer.h:3561
fpl_common_api void fplSetDefaultSettings(fplSettings *settings)
Resets the given settings container to default values for window, video, audio, etc.