diff --git a/src/Magnum/Platform/GlutApplication.cpp b/src/Magnum/Platform/GlutApplication.cpp index 58f8bc1ec..8009451b4 100644 --- a/src/Magnum/Platform/GlutApplication.cpp +++ b/src/Magnum/Platform/GlutApplication.cpp @@ -90,6 +90,9 @@ bool GlutApplication::tryCreateContext(const Configuration& configuration) { #endif } + /* Set context flags */ + glutInitContextFlags(int(configuration.flags())); + if(!glutCreateWindow(configuration.title().data())) { Error() << "Platform::GlutApplication::tryCreateContext(): cannot create context"; return false; diff --git a/src/Magnum/Platform/GlutApplication.h b/src/Magnum/Platform/GlutApplication.h index 4947351da..6ab203118 100644 --- a/src/Magnum/Platform/GlutApplication.h +++ b/src/Magnum/Platform/GlutApplication.h @@ -280,6 +280,26 @@ Double-buffered RGBA window with depth and stencil buffers. */ class GlutApplication::Configuration { public: + /** + * @brief Context flag + * + * @see @ref Flags @ref setFlags() + */ + enum class Flag: int { + Debug = GLUT_DEBUG /**< Create debug context */ + }; + + /** + * @brief Context flags + * + * @see @ref setFlags() + */ + #ifndef DOXYGEN_GENERATING_OUTPUT + typedef Containers::EnumSet Flags; + #else + typedef Containers::EnumSet Flags; + #endif + /*implicit*/ Configuration(); ~Configuration(); @@ -311,6 +331,20 @@ class GlutApplication::Configuration { return *this; } + /** @brief Context flags */ + Flags flags() const { return _flags; } + + /** + * @brief Set context flags + * @return Reference to self (for method chaining) + * + * Default is no flag. + */ + Configuration& setFlags(Flags flags) { + _flags = flags; + return *this; + } + /** @brief Context version */ Version version() const { return _version; } @@ -348,8 +382,11 @@ class GlutApplication::Configuration { Vector2i _size; Int _sampleCount; Version _version; + Flags _flags; }; +CORRADE_ENUMSET_OPERATORS(GlutApplication::Configuration::Flags) + /** @brief Base for input events