OPENGL: Allow runtime specification of OpenGL mode.

Formerly, we required that the OpenGL mode was fixed at compile time. Now we
allow the code to work with whatever it is given at runtime.

It is still possible to force a context type on compile time.
This commit is contained in:
Johannes Schickel 2015-12-12 22:08:33 +01:00
parent 9816e4f350
commit d6d3e17d53
8 changed files with 164 additions and 52 deletions

View file

@ -28,15 +28,23 @@
namespace OpenGL {
void Context::reset() {
ready = false;
type = kContextGL;
NPOTSupported = false;
}
Context g_context;
void OpenGLGraphicsManager::initializeGLContext() {
void OpenGLGraphicsManager::initializeGLContext(ContextType type) {
// Initialize default state.
g_context.reset();
#if USE_FORCED_GL
type = kContextGL;
#elif USE_FORCED_GLES
type = kContextGLES;
#endif
// Load all functions.
// We use horrible trickery to silence C++ compilers.
// See backends/plugins/sdl/sdl-provider.cpp for more information.
@ -64,6 +72,9 @@ void OpenGLGraphicsManager::initializeGLContext() {
g_context.NPOTSupported = true;
}
}
g_context.ready = true;
g_context.type = type;
}
} // End of namespace OpenGL