-
Notifications
You must be signed in to change notification settings - Fork 13
Initialization Overview
- Initialize a video context
- Enable/Disable Vertical Synchronization
- Disable unneeded video backends
- Disable all Video Output
- Notes
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.
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 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.
if (()) {
// ... your code here
}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.
settings;
(&settings);
&videoSettings = settings.;
// Forcing the video backend to be OpenGL
videoSettings. = ;
if ((, &settings)) {
// ... your code here
}If you want to enable/disable vertical synchronization you simply set the fplVideoSettings.isVSync field respectively.
Note: There is no guarantee that vertical synchronization is supported by your video device or selected backend.
Software video output does not support vertical synchronization!
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):
#define FPL_NO_VIDEO_OPENGL
#define FPL_IMPLEMENTATION
#include <final_platform_layer.h>To compile out all video output code you define the FPL_NO_VIDEO preprocessor directive.
#define FPL_NO_VIDEO
#define FPL_IMPLEMENTATION
#include <final_platform_layer.h>Note: Keep in mind that this is not useful for window-based applications!
If you are writing a console application and don't want any video output whatsoever, set
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.
- Assertion & Debug
- Atomic operations
- Audio functions
- Clipboard functions
- Console functions
- Constants
- Display/Monitor functions
- Dynamic library loading
- Error Handling
- Files/IO functions
- Function macros
- Hardware Infos
- Input types and functions
- Localization functions
- Logging
- Memory Macros
- Memory functions
- Operating system Infos
- Path functions
- Platform functions
- Session Infos
- Settings & Configurations
- Storage class identifiers
- String functions
- Threading and synchronizations routines
- Timing functions
- Video functions
- Window events
- Window functions
- fplARMCPUCapabilities
- fplAudioChannelMap
- fplAudioDeviceID
- fplAudioDeviceInfo
- fplAudioFormat
- fplAudioSettings
- fplColor32
- fplConditionVariable
- fplConsoleSettings
- fplCPUCapabilities
- fplCPUIDLeaf
- fplDateTime
- fplDateTimeCreationResult
- fplDateTimeResult
- fplDisplayInfo
- fplDisplayMode
- fplDynamicLibraryHandle
- fplEndianess
- fplEvent
- fplFileEntry
- fplFileHandle
- fplFilePermissions
- fplFileTimeStamps
- fplGamepadButton
- fplGamepadData
- fplGamepadEvent
- fplGamepadInfo
- fplGamepadInputBinding
- fplGamepadMapping
- fplGamepadSettings
- fplGamepadState
- fplGamepadStates
- fplGraphicsApiSettings
- fplImageSource
- fplInputBackendMask
- fplInputBackendSupport
- fplInputDevice
- fplInputDeviceGuid
- fplInputSettings
- fplInternalConditionVariable
- fplInternalDynamicLibraryHandle
- fplInternalFileEntryHandle
- fplInternalFileHandle
- fplInternalFileRootInfo
- fplInternalMutexHandle
- fplInternalSemaphoreHandle
- fplInternalSignalHandle
- fplInternalThreadHandle
- fplKeyboardEvent
- fplKeyboardState
- fplLogSettings
- fplLogWriter
- fplLogWriterConsole
- fplLogWriterCustom
- fplMemoryAllocationSettings
- fplMemoryBlock
- fplMemoryInfos
- fplMemorySettings
- fplMouseEvent
- fplMouseState
- fplMutexHandle
- fplOpenGLSettings
- fplOSVersionInfos
- fplSemaphoreHandle
- fplSettings
- fplSignalHandle
- fplSpecificAudioSettings
- fplThreadHandle
- fplThreadParameters
- fplTimestamp
- fplVersionInfo
- fplVideoBackBuffer
- fplVideoRect
- fplVideoRequirements
- fplVideoRequirementsVulkan
- fplVideoSettings
- fplVideoSurface
- fplVideoSurfaceOpenGL
- fplVideoSurfaceVulkan
- fplVideoWindow
- fplVulkanSettings
- fplWindowCallbacks
- fplWindowDropFiles
- fplWindowEvent
- fplWindowPosition
- fplWindowSettings
- fplWindowSize
- fplX86CPUCapabilities