fix opengl context creation

This commit is contained in:
Vadim Lopatin 2015-03-16 09:39:29 +03:00
parent 027cfdb685
commit f599a7e4df
3 changed files with 18 additions and 15 deletions

View File

@ -25,9 +25,6 @@ mixin APP_ENTRY_POINT;
/// entry point for dlangui based application /// entry point for dlangui based application
extern (C) int UIAppMain(string[] args) { extern (C) int UIAppMain(string[] args) {
//auto power2 = delegate(int X) { return X * X; };
auto power2 = (int X) => X * X;
// embed resources listed in views/resources.list into executable // embed resources listed in views/resources.list into executable
embeddedResourceList.addResources(embedResourcesFromList!("resources.list")()); embeddedResourceList.addResources(embedResourcesFromList!("resources.list")());

View File

@ -1390,6 +1390,7 @@ int sdlmain(string[] args) {
// we want OpenGL 3.3 // we want OpenGL 3.3
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION,3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION,3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION,2); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION,2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
// Set OpenGL attributes // Set OpenGL attributes
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);

View File

@ -1020,6 +1020,7 @@ int myWinMain(void* hInstance, void* hPrevInstance, char* lpCmdLine, int iCmdSho
currentTheme = createDefaultTheme(); currentTheme = createDefaultTheme();
version (USE_OPENGL) { version (USE_OPENGL) {
try {
import derelict.opengl3.gl3; import derelict.opengl3.gl3;
DerelictGL3.load(); DerelictGL3.load();
@ -1033,6 +1034,10 @@ int myWinMain(void* hInstance, void* hPrevInstance, char* lpCmdLine, int iCmdSho
Log.w("OpenGL support is disabled"); Log.w("OpenGL support is disabled");
// process messages // process messages
platform.enterMessageLoop(); platform.enterMessageLoop();
} catch (Exception e) {
Log.e("Exception while trying to init OpenGL", e);
openglEnabled = false;
}
} }
// Load versions 1.2+ and all supported ARB and EXT extensions. // Load versions 1.2+ and all supported ARB and EXT extensions.