Magnum::Platform::Sdl2Application::GLConfiguration class

OpenGL context configuration.

The created window is always with a double-buffered OpenGL context.

Base classes

class Magnum::GL::Context::Configuration new in Git master

Public types

enum class Flag: UnsignedLong { ForwardCompatible = SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG, Debug = SDL_GL_CONTEXT_DEBUG_FLAG, RobustAccess = SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG, ResetIsolation = SDL_GL_CONTEXT_RESET_ISOLATION_FLAG, NoError = 1ull << 32 new in Git master, QuietLog = UnsignedLong(GL::Context::Configuration::Flag::QuietLog) new in Git master, VerboseLog = UnsignedLong(GL::Context::Configuration::Flag::VerboseLog) new in Git master, GpuValidation = UnsignedLong(GL::Context::Configuration::Flag::GpuValidation) new in Git master, GpuValidationNoError = UnsignedLong(GL::Context::Configuration::Flag::GpuValidationNoError) new in Git master }
Context flag.
using Flags = Containers::EnumSet<Flag>
Context flags.

Public functions

auto flags() const -> Flags
Context flags.
auto setFlags(Flags flags) -> GLConfiguration&
Set context flags.
auto addFlags(Flags flags) -> GLConfiguration&
Add context flags.
auto clearFlags(Flags flags) -> GLConfiguration&
Clear context flags.
auto version() const -> GL::Version
Context version.
auto setVersion(GL::Version version) -> GLConfiguration&
Set context version.
auto colorBufferSize() const -> Vector4i
Color buffer size.
auto setColorBufferSize(const Vector4i& size) -> GLConfiguration&
Set color buffer size.
auto depthBufferSize() const -> Int
Depth buffer size.
auto setDepthBufferSize(Int size) -> GLConfiguration&
Set depth buffer size.
auto stencilBufferSize() const -> Int
Stencil buffer size.
auto setStencilBufferSize(Int size) -> GLConfiguration&
Set stencil buffer size.
auto sampleCount() const -> Int
Sample count.
auto setSampleCount(Int count) -> GLConfiguration&
Set sample count.
auto isSrgbCapable() const -> bool
sRGB-capable default framebuffer
auto setSrgbCapable(bool enabled) -> GLConfiguration&
Set sRGB-capable default framebuffer.

Enum documentation

enum class Magnum::Platform::Sdl2Application::GLConfiguration::Flag: UnsignedLong

Context flag.

Includes also everything from GL::Context::Configuration::Flag except for Flag::Windowless, which is not meant to be enabled for windowed apps.


Forward compatible context.


Debug context. Enabled automatically if supported by the driver and the Flag::GpuValidation flag is set or if the --magnum-gpu-validation command-line option is set to on.


Context with robust access.


Context with reset isolation.

NoError new in Git master

Context without error reporting. Might result in better performance, but situations that would have generated errors instead cause undefined behavior. Enabled automatically if supported by the driver and the Flag::GpuValidationNoError flag is set or if the --magnum-gpu-validation command-line option is set to no-error.

QuietLog new in Git master

Print only warnings and errors instead of the usual startup log listing used extensions and workarounds. Ignored if Flag::VerboseLog is set.

Corresponds to the --magnum-log quiet command-line option.

VerboseLog new in Git master

Print additional information on startup in addition to the usual startup log that lists used extensions and workarounds. Has a precedence over Flag::QuietLog.

Corresponds to the --magnum-log verbose command-line option.

GpuValidation new in Git master

Enable GPU validation, if available. Has a precedence over Flag::GpuValidationNoError.

Corresponds to the --magnum-gpu-validation on command-line option.

GpuValidationNoError new in Git master

Enable a context without error reporting, if available. Ignored if Flag::GpuValidation is set.

Corresponds to the --magnum-gpu-validation no-error command-line option.

Typedef documentation

typedef Containers::EnumSet<Flag> Magnum::Platform::Sdl2Application::GLConfiguration::Flags

Context flags.

Function documentation

GLConfiguration& Magnum::Platform::Sdl2Application::GLConfiguration::setFlags(Flags flags)

Set context flags.

Returns Reference to self (for method chaining)

Default is Flag::ForwardCompatible on desktop GL and no flags on OpenGL ES. To avoid clearing default flags by accident, prefer to use addFlags() and clearFlags() instead.

GLConfiguration& Magnum::Platform::Sdl2Application::GLConfiguration::addFlags(Flags flags)

Add context flags.

Returns Reference to self (for method chaining)

Unlike setFlags(), ORs the flags with existing instead of replacing them. Useful for preserving the defaults.

GLConfiguration& Magnum::Platform::Sdl2Application::GLConfiguration::clearFlags(Flags flags)

Clear context flags.

Returns Reference to self (for method chaining)

Unlike setFlags(), ANDs the inverse of flags with existing instead of replacing them. Useful for removing default flags.

GL::Version Magnum::Platform::Sdl2Application::GLConfiguration::version() const

Context version.

GLConfiguration& Magnum::Platform::Sdl2Application::GLConfiguration::setVersion(GL::Version version)

Set context version.

If requesting version greater or equal to OpenGL 3.1, core profile is used. The created context will then have any version which is backwards-compatible with requested one. Default is GL::Version::None, i.e. any provided version is used.

GLConfiguration& Magnum::Platform::Sdl2Application::GLConfiguration::setColorBufferSize(const Vector4i& size)

Set color buffer size.

Default is {8, 8, 8, 8} (8-bit-per-channel RGBA).

GLConfiguration& Magnum::Platform::Sdl2Application::GLConfiguration::setDepthBufferSize(Int size)

Set depth buffer size.

Default is 24 bits.

GLConfiguration& Magnum::Platform::Sdl2Application::GLConfiguration::setStencilBufferSize(Int size)

Set stencil buffer size.

Default is 0 bits (i.e., no stencil buffer).

GLConfiguration& Magnum::Platform::Sdl2Application::GLConfiguration::setSampleCount(Int count)

Set sample count.

Returns Reference to self (for method chaining)

Default is 0, thus no multisampling. See also GL::Renderer::Feature::Multisampling.

bool Magnum::Platform::Sdl2Application::GLConfiguration::isSrgbCapable() const

sRGB-capable default framebuffer

GLConfiguration& Magnum::Platform::Sdl2Application::GLConfiguration::setSrgbCapable(bool enabled)

Set sRGB-capable default framebuffer.

Returns Reference to self (for method chaining)

Default is false. See also GL::Renderer::Feature::FramebufferSrgb.