Browse Source

Minor changes for consistency

pull/433/head
Stéphane Brard 6 years ago
parent
commit
82cfdce409
  1. 15
      src/Magnum/Platform/WindowlessGlxApplication.cpp
  2. 8
      src/Magnum/Platform/WindowlessGlxApplication.h

15
src/Magnum/Platform/WindowlessGlxApplication.cpp

@ -40,15 +40,6 @@ namespace Magnum { namespace Platform {
WindowlessGlxContext::WindowlessGlxContext(const WindowlessGlxContext::Configuration& configuration, GLContext* const magnumContext) { WindowlessGlxContext::WindowlessGlxContext(const WindowlessGlxContext::Configuration& configuration, GLContext* const magnumContext) {
_display = XOpenDisplay(nullptr); _display = XOpenDisplay(nullptr);
/**
* The user can choose to create a windowless application with a dedicated OpenGL context
* or give an OpenGL context to create a shared Context instead.
*
* Here, we ask the configuration whether a context has been specified by the user
* (!= nullptr) or not.
*/
GLXContext ctx = configuration.sharedContext();
/* Check version */ /* Check version */
int major, minor; int major, minor;
glXQueryVersion(_display, &major, &minor); glXQueryVersion(_display, &major, &minor);
@ -103,7 +94,7 @@ WindowlessGlxContext::WindowlessGlxContext(const WindowlessGlxContext::Configura
#endif #endif
0 0
}; };
_context = glXCreateContextAttribsARB(_display, configs[0], ctx, True, contextAttributes); _context = glXCreateContextAttribsARB(_display, configs[0], configuration.sharedContext(), True, contextAttributes);
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/* Fall back to (forward compatible) GL 2.1 if core context creation fails */ /* Fall back to (forward compatible) GL 2.1 if core context creation fails */
@ -114,7 +105,7 @@ WindowlessGlxContext::WindowlessGlxContext(const WindowlessGlxContext::Configura
GLX_CONTEXT_FLAGS_ARB, GLint(flags), GLX_CONTEXT_FLAGS_ARB, GLint(flags),
0 0
}; };
_context = glXCreateContextAttribsARB(_display, configs[0], ctx, True, fallbackContextAttributes); _context = glXCreateContextAttribsARB(_display, configs[0], configuration.sharedContext(), True, fallbackContextAttributes);
/* Fall back to (forward compatible) GL 2.1 if we are on binary NVidia/AMD /* Fall back to (forward compatible) GL 2.1 if we are on binary NVidia/AMD
drivers on Linux. Instead of creating forward-compatible context with drivers on Linux. Instead of creating forward-compatible context with
@ -151,7 +142,7 @@ WindowlessGlxContext::WindowlessGlxContext(const WindowlessGlxContext::Configura
GLX_CONTEXT_FLAGS_ARB, GLint(flags & ~Configuration::Flag::ForwardCompatible), GLX_CONTEXT_FLAGS_ARB, GLint(flags & ~Configuration::Flag::ForwardCompatible),
0 0
}; };
_context = glXCreateContextAttribsARB(_display, configs[0], ctx, True, fallbackContextAttributes); _context = glXCreateContextAttribsARB(_display, configs[0], configuration.sharedContext(), True, fallbackContextAttributes);
} }
/* Revert back the old context */ /* Revert back the old context */

8
src/Magnum/Platform/WindowlessGlxApplication.h

@ -258,13 +258,7 @@ class WindowlessGlxContext::Configuration {
} }
private: private:
/**
* If the @ref Configuration opengl context
* is shared with another context, then _sharedContext points to
* this context.
*
* Otherwise = nullptr;
*/
GLXContext _sharedContext{nullptr}; GLXContext _sharedContext{nullptr};
Flags _flags; Flags _flags;
}; };

Loading…
Cancel
Save