From 78c5408dcf423cfd7c1fab90c4be2f5561a29561 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Thu, 3 Dec 2015 14:47:45 +0300 Subject: [PATCH] fix opengl support under win32 --- src/dlangui/platforms/windows/winapp.d | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/dlangui/platforms/windows/winapp.d b/src/dlangui/platforms/windows/winapp.d index 5ac99b68..3476d044 100644 --- a/src/dlangui/platforms/windows/winapp.d +++ b/src/dlangui/platforms/windows/winapp.d @@ -216,20 +216,17 @@ class Win32Window : Window { if (!DERELICT_GL3_RELOADED) { // run this code only once + if (!_glSupport) { + Log.v("Creating OpenGL support"); + _glSupport = new GLSupport(true); + Log.v("OpenGL support created"); + } + DERELICT_GL3_RELOADED = true; try { import derelict.opengl3.gl3; DerelictGL3.reload(); - static if (ENABLE_OPENGL) { - //_gl = new GLSupport(); - if (!_glSupport) { - Log.v("Creating OpenGL support"); - _glSupport = new GLSupport(true); - Log.v("OpenGL support created"); - } - } - // successful Log.v("initializing shaders"); if (glSupport.valid || glSupport.initShaders()) { @@ -309,6 +306,7 @@ class Win32Window : Window { buf.afterDrawing(); SwapBuffers(hdc); wglMakeCurrent(hdc, null); + destroy(buf); } } @@ -999,6 +997,8 @@ int myWinMain(void* hInstance, void* hPrevInstance, char* lpCmdLine, int iCmdSho static if (ENABLE_OPENGL) { try { import derelict.opengl3.gl3; + import derelict.opengl3.gl; + DerelictGL.load(); DerelictGL3.load(); // //// just to check OpenGL context