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
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
embeddedResourceList.addResources(embedResourcesFromList!("resources.list")());

View File

@ -1390,6 +1390,7 @@ int sdlmain(string[] args) {
// we want OpenGL 3.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_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
// Set OpenGL attributes
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);

View File

@ -1020,19 +1020,24 @@ int myWinMain(void* hInstance, void* hPrevInstance, char* lpCmdLine, int iCmdSho
currentTheme = createDefaultTheme();
version (USE_OPENGL) {
import derelict.opengl3.gl3;
DerelictGL3.load();
try {
import derelict.opengl3.gl3;
DerelictGL3.load();
// just to check OpenGL context
Log.i("Trying to setup OpenGL context");
Win32Window tmpWindow = new Win32Window(w32platform, ""d, null, 0);
destroy(tmpWindow);
if (openglEnabled)
Log.i("OpenGL support is enabled");
else
Log.w("OpenGL support is disabled");
// process messages
platform.enterMessageLoop();
// just to check OpenGL context
Log.i("Trying to setup OpenGL context");
Win32Window tmpWindow = new Win32Window(w32platform, ""d, null, 0);
destroy(tmpWindow);
if (openglEnabled)
Log.i("OpenGL support is enabled");
else
Log.w("OpenGL support is disabled");
// process messages
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.