Magnum::Platform::WindowlessCglContext class

Windowless CGL context.

GL context used in WindowlessCglApplication. Does not have any default framebuffer. It is built if WITH_WINDOWLESSCGLAPPLICATION is enabled in CMake.

Meant to be used when there is a need to manage (multiple) GL contexts manually. See Manually managing windowless contexts for more information. If no other application header is included, this class is also aliased to Platform::WindowlessGLContext.

Public types

class Configuration
Configuration.

Constructors, destructors, conversion operators

WindowlessCglContext(const Configuration& configuration, GLContext* context = nullptr) explicit
Constructor.
WindowlessCglContext(NoCreateT) explicit
Construct without creating the context.
WindowlessCglContext(const WindowlessCglContext&) deleted
Copying is not allowed.
WindowlessCglContext(WindowlessCglContext&& other)
Move constructor.
~WindowlessCglContext()
Destructor.

Public functions

auto operator=(const WindowlessCglContext&) -> WindowlessCglContext& deleted
Copying is not allowed.
auto operator=(WindowlessCglContext&& other) -> WindowlessCglContext&
Move assignment.
auto isCreated() const -> bool
Whether the context is created.
auto makeCurrent() -> bool
Make the context current.

Function documentation

Magnum::Platform::WindowlessCglContext::WindowlessCglContext(const Configuration& configuration, GLContext* context = nullptr) explicit

Constructor.

Parameters
configuration Context configuration
context Optional Magnum context instance constructed using NoCreate to manage driver workarounds

If version is not specified in configuration, it first tries to create core context (OpenGL 3.2+), if that fails, tries OpenGL 3.0+ and as a last attempt falls back to compatibility OpenGL 2.1 context.

Once the context is created, make it current using makeCurrent() and create Platform::GLContext instance to be able to use Magnum.

Magnum::Platform::WindowlessCglContext::WindowlessCglContext(NoCreateT) explicit

Construct without creating the context.

Move a instance with created context over to make it usable.

Magnum::Platform::WindowlessCglContext::~WindowlessCglContext()

Destructor.

Destroys the context, if any.

bool Magnum::Platform::WindowlessCglContext::makeCurrent()

Make the context current.

Prints error message and returns false on failure, otherwise returns true.