class
#include <Magnum/Platform/GLContext.h>
GLContext Platform-specific OpenGL context.
In most cases not needed to be used directly as the initialization is done automatically in *Application
classes. See Platform support for more information.
Base classes
- class Magnum::GL::Context
- Magnum OpenGL context.
Constructors, destructors, conversion operators
- GLContext(Int argc, const char*const* argv, const Configuration& configuration = {}) explicit
- Constructor.
- GLContext(const Configuration& configuration = {}) explicit
- Default constructor.
- GLContext(NoCreateT, Int argc, const char*const* argv) explicit
- Construct without creating the context.
- GLContext(NoCreateT) explicit
- Construct with creation delayed to later.
Public functions
- void create(const Configuration& configuration = Configuration{})
- Create the context.
- auto tryCreate(const Configuration& configuration = Configuration{}) -> bool
- Try to create the context.
Function documentation
Magnum:: Platform:: GLContext:: GLContext(Int argc,
const char*const* argv,
const Configuration& configuration = {}) explicit
Constructor.
Equivalent to calling GLContext(NoCreateT, Int, const char* const*) followed by create(const Configuration&).
Magnum:: Platform:: GLContext:: GLContext(const Configuration& configuration = {}) explicit
Default constructor.
Equivalent to passing {0, nullptr, configuration}
to GLContext(Int, const char* const*, const Configuration&). Even if the command-line options are not propagated, it's still possible to affect the setup behavior from the environment or by passing a Configuration instance. See Creating a context for more information.
Magnum:: Platform:: GLContext:: GLContext(NoCreateT,
Int argc,
const char*const* argv) explicit
Construct without creating the context.
Parses command-line arguments and sets version() to GL::
Magnum:: Platform:: GLContext:: GLContext(NoCreateT) explicit
Construct with creation delayed to later.
Equivalent to passing {NoCreate, 0, nullptr}
to GLContext(NoCreateT, Int, const char* const*). Even if the command-line options are not propagated, it's still possible to affect the renderer behavior from the environment or by passing a Configuration instance to create() or tryCreate(). See Creating a context for more information.
void Magnum:: Platform:: GLContext:: create(const Configuration& configuration = Configuration{})
Create the context.
Meant to be called on a NoCreate'd instance. Parses command-line arguments, loads OpenGL function pointers using a platform-specific API, does initial setup, detects available features and enables them throughout the engine. If detected version is unsupported or any other error occurs, a message is printed to output and the application exits. See tryCreate() for an alternative.
bool Magnum:: Platform:: GLContext:: tryCreate(const Configuration& configuration = Configuration{})
Try to create the context.
Unlike create(), instead of exiting prints a message to error output and returns false
on error.