Magnum::Platform::GlxApplication class

GLX application.

Application using pure X11 and GLX. Supports keyboard and mouse handling. Available on desktop OpenGL and OpenGL ES using GLX on Linux.

Bootstrap application

The usage is very similar to Sdl2Application, for which fully contained base application along with CMake setup is available, see its documentation for more information.

General usage

This application library depends on the X11 library and is built if MAGNUM_WITH_GLXAPPLICATION is enabled when building Magnum. To use this library with CMake, request the GlxApplication component of the Magnum package and link to the Magnum::GlxApplication target:

find_package(Magnum REQUIRED GlxApplication)

# ...
target_link_libraries(your-app PRIVATE Magnum::GlxApplication)

Additionally, if you're using Magnum as a CMake subproject, do the following before calling find_package() to ensure it's enabled, as the library is not built by default:

set(MAGNUM_WITH_GLXAPPLICATION ON CACHE BOOL "" FORCE)
add_subdirectory(magnum EXCLUDE_FROM_ALL)

If no other application is requested, you can also use the generic Magnum::Application alias to simplify porting. See Downloading and building and Usage with CMake for more information.

In C++ code you need to implement at least drawEvent() to be able to draw on the screen. The subclass can be then used directly in main() — see convenience macro MAGNUM_GLXAPPLICATION_MAIN(). See Platform support for more information.

class MyApplication: public Platform::GlxApplication {
    // implement required methods...
};
MAGNUM_GLXAPPLICATION_MAIN(MyApplication)

If no other application header is included, this class is also aliased to Platform::Application and the macro is aliased to MAGNUM_APPLICATION_MAIN() to simplify porting.

Base classes

class AbstractXApplication
Base for X11-based applications.

Constructors, destructors, conversion operators

GlxApplication(const Arguments& arguments, const Configuration& configuration = Configuration{}, const GLConfiguration& glConfiguration = GLConfiguration{}) explicit
Construct with an OpenGL context.
GlxApplication(const Arguments& arguments, NoCreateT) explicit
Construct without creating a window.

Function documentation

Magnum::Platform::GlxApplication::GlxApplication(const Arguments& arguments, const Configuration& configuration = Configuration{}, const GLConfiguration& glConfiguration = GLConfiguration{}) explicit

Construct with an OpenGL context.

Parameters
arguments Application arguments
configuration Application configuration
glConfiguration OpenGL context configuration

Creates application with default or user-specified configuration. See Configuration and GLConfiguration for more information. The program exits if the context cannot be created, see tryCreate() for an alternative.

Magnum::Platform::GlxApplication::GlxApplication(const Arguments& arguments, NoCreateT) explicit

Construct without creating a window.

Parameters
arguments Application arguments

Unlike above, the window is not created and must be created later with create() or tryCreate().