Magnum::Platform::WindowlessWindowsEglApplication class

Windowless Windows/EGL application.

Application for offscreen rendering using WindowlessWindowsEglContext. This application library is available on OpenGL ES (also ANGLE) on Windows. It is built if WITH_WINDOWLESSWINDOWSEGLAPPLICATION is enabled in CMake.

Bootstrap application

Fully contained windowless application using WindowlessWindowsEglApplication along with CMake setup is available in windowless branch of Magnum Bootstrap repository, download it as tar.gz or zip file. After extracting the downloaded archive you can build and run the application with these four commands:

mkdir build && cd build
cmake ..
cmake --build .
./src/MyApplication # or ./src/Debug/MyApplication

See Usage with CMake for more information.

General usage

In order to use this library from CMake, you need to copy FindEGL.cmake from the modules directory in Magnum source to the modules/ dir in your project (so it is able to find the EGL library). Request the WindowlessWindowsEglApplication component of the Magnum package and link to the Magnum::WindowlessGlxApplication target:

find_package(Magnum REQUIRED)
if(CORRADE_TARGET_WINDOWS)
    find_package(Magnum REQUIRED WindowlessWindowsEglApplication)
endif()

# ...
if(CORRADE_TARGET_WINDOWS)
    target_link_libraries(your-app Magnum::WindowlessWindowsEglApplication)
endif()

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

Place your code into exec(). The subclass can be then used in main function using MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_MAIN() macro. See Platform support for more information.

class MyApplication: public Platform::WindowlessWindowsEglApplication {
    // implement required methods...
};
MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_MAIN(MyApplication)

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

Public types

struct Arguments
Application arguments.
using Configuration = WindowlessWindowsEglContext::Configuration
Configuration.

Constructors, destructors, conversion operators

WindowlessWindowsEglApplication(const Arguments& arguments, const Configuration& configuration = Configuration()) explicit
Default constructor.
WindowlessWindowsEglApplication(const Arguments& arguments, NoCreateT) explicit
Constructor.
WindowlessWindowsEglApplication(const WindowlessWindowsEglApplication&) deleted
Copying is not allowed.
WindowlessWindowsEglApplication(WindowlessWindowsEglApplication&&) deleted
Moving is not allowed.

Public functions

auto operator=(const WindowlessWindowsEglApplication&) -> WindowlessWindowsEglApplication& deleted
Copying is not allowed.
auto operator=(WindowlessWindowsEglApplication&&) -> WindowlessWindowsEglApplication& deleted
Moving is not allowed.
auto exec() -> int pure virtual
Execute application.

Protected functions

void createContext(const Configuration& configuration = Configuration())
Create context with given configuration.
auto tryCreateContext(const Configuration& configuration) -> bool
Try to create context with given configuration.

Typedef documentation

typedef WindowlessWindowsEglContext::Configuration Magnum::Platform::WindowlessWindowsEglApplication::Configuration

Configuration.

Function documentation

Magnum::Platform::WindowlessWindowsEglApplication::WindowlessWindowsEglApplication(const Arguments& arguments, const Configuration& configuration = Configuration()) explicit

Default constructor.

Parameters
arguments Application arguments
configuration Configuration

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

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

Constructor.

Parameters
arguments Application arguments

Unlike above, the context is not created and must be created later with createContext() or tryCreateContext().

int Magnum::Platform::WindowlessWindowsEglApplication::exec() pure virtual

Execute application.

Returns Value for returning from main()

See MAGNUM_WINDOWLESSWINDOWSEGLAPPLICATION_MAIN() for usage information.

void Magnum::Platform::WindowlessWindowsEglApplication::createContext(const Configuration& configuration = Configuration()) protected

Create context with given configuration.

Must be called if and only if the context wasn't created by the constructor itself. Error message is printed and the program exits if the context cannot be created, see tryCreateContext() for an alternative.

bool Magnum::Platform::WindowlessWindowsEglApplication::tryCreateContext(const Configuration& configuration) protected

Try to create context with given configuration.

Unlike createContext() returns false if the context cannot be created, true otherwise.