mirror of https://github.com/buggins/dlangui.git
Try creating OpenGL 2.1, 2.0 context if v3.2 context creation is failed
This commit is contained in:
parent
f599a7e4df
commit
057a37df3e
|
@ -144,11 +144,28 @@ class SDLWindow : Window {
|
|||
}
|
||||
version(USE_OPENGL) {
|
||||
if (_enableOpengl) {
|
||||
Log.i("Trying to create OpenGL 3.2 context");
|
||||
_context = SDL_GL_CreateContext(_win); // Create the actual context and make it current
|
||||
if (!_context) {
|
||||
Log.e("SDL_GL_CreateContext failed: ", fromStringz(SDL_GetError()));
|
||||
_enableOpengl = false;
|
||||
} else if (!_gl3Reloaded) {
|
||||
Log.e("SDL_GL_CreateContext failed for version 3.2: ", fromStringz(SDL_GetError()));
|
||||
Log.w("Trying to create OpenGL 2.1 context");
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION,2);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION,1);
|
||||
_context = SDL_GL_CreateContext(_win); // Create the actual context and make it current
|
||||
if (!_context) {
|
||||
Log.e("SDL_GL_CreateContext failed: ", fromStringz(SDL_GetError()));
|
||||
Log.w("Trying to create OpenGL 2.0 context");
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION,2);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION,0);
|
||||
_context = SDL_GL_CreateContext(_win); // Create the actual context and make it current
|
||||
if (!_context) {
|
||||
Log.e("SDL_GL_CreateContext failed: ", fromStringz(SDL_GetError()));
|
||||
_enableOpengl = false;
|
||||
Log.w("OpenGL support is disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_context && !_gl3Reloaded) {
|
||||
DerelictGL3.reload();
|
||||
_gl3Reloaded = true;
|
||||
if (!glSupport.valid && !glSupport.initShaders())
|
||||
|
@ -1387,7 +1404,7 @@ int sdlmain(string[] args) {
|
|||
int request = SDL_GetDesktopDisplayMode(0,&displayMode);
|
||||
|
||||
version(USE_OPENGL) {
|
||||
// we want OpenGL 3.3
|
||||
// we want OpenGL 3.2
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION,3);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION,2);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||
|
|
Loading…
Reference in New Issue