From 167e129f00cb3464861a7aff7c57aa2021a9bd12 Mon Sep 17 00:00:00 2001 From: gazer Date: Wed, 7 Jun 2017 21:52:27 +0300 Subject: [PATCH] platform fixes --- src/dlangui/platforms/console/consoleapp.d | 1 + src/dlangui/platforms/dsfml/dsfmlapp.d | 16 +--------------- src/dlangui/platforms/sdl/sdlapp.d | 4 ++-- src/dlangui/platforms/windows/winapp.d | 4 ++-- src/dlangui/platforms/x11/x11app.d | 19 +++++-------------- 5 files changed, 11 insertions(+), 33 deletions(-) diff --git a/src/dlangui/platforms/console/consoleapp.d b/src/dlangui/platforms/console/consoleapp.d index 94c12365..6fb4e14c 100644 --- a/src/dlangui/platforms/console/consoleapp.d +++ b/src/dlangui/platforms/console/consoleapp.d @@ -8,6 +8,7 @@ import dlangui.platforms.common.platform; import dlangui.graphics.drawbuf; import dlangui.graphics.fonts; import dlangui.widgets.styles; +import dlangui.widgets.widget; import dlangui.platforms.console.consolefont; private import dlangui.platforms.console.dconsole; diff --git a/src/dlangui/platforms/dsfml/dsfmlapp.d b/src/dlangui/platforms/dsfml/dsfmlapp.d index d3cd9f60..fc6e962d 100644 --- a/src/dlangui/platforms/dsfml/dsfmlapp.d +++ b/src/dlangui/platforms/dsfml/dsfmlapp.d @@ -76,17 +76,6 @@ class DSFMLWindow : dlangui.platforms.common.platform.Window { private void paintUsingOpenGL() { import derelict.opengl3.gl3; - import dlangui.graphics.gldrawbuf; - import dlangui.graphics.glsupport; - if (!_gl3Reloaded) { - DerelictGL3.reload(); - _gl3Reloaded = true; - if (!glSupport.valid && !glSupport.initShaders()) { - Log.d("Cannot init opengl"); - assert(0); - } - } - glDisable(GL_DEPTH_TEST); glViewport(0, 0, _dx, _dy); @@ -422,11 +411,8 @@ void initDSFMLApp() { currentTheme = createDefaultTheme(); - import derelict.opengl3.gl3; import dlangui.graphics.glsupport; - DerelictGL3.load(); - if (!_glSupport) - _glSupport = new GLSupport(); + initGLSupport(false); Platform.instance.uiTheme = "theme_dark"; } diff --git a/src/dlangui/platforms/sdl/sdlapp.d b/src/dlangui/platforms/sdl/sdlapp.d index a7cc31ca..5d9b24ec 100644 --- a/src/dlangui/platforms/sdl/sdlapp.d +++ b/src/dlangui/platforms/sdl/sdlapp.d @@ -291,8 +291,8 @@ class SDLWindow : Window { Log.w("OpenGL support is disabled"); } } - if (success && !_glSupport) { - _enableOpengl = initGLSupport(false); + if (success) { + _enableOpengl = initGLSupport(_platform.GLVersionMajor < 3); fixSize(); } } diff --git a/src/dlangui/platforms/windows/winapp.d b/src/dlangui/platforms/windows/winapp.d index c5115477..a741db4f 100644 --- a/src/dlangui/platforms/windows/winapp.d +++ b/src/dlangui/platforms/windows/winapp.d @@ -183,7 +183,7 @@ static if (ENABLE_OPENGL) { _hGLRC = wglCreateContext(hDC); if (_hGLRC) { bind(hDC); - bool initialized = initGLSupport(false); + bool initialized = initGLSupport(Platform.instance.GLVersionMajor < 3); unbind(hDC); if (!initialized) { uninit(); @@ -281,7 +281,7 @@ class Win32Window : Window { /* initialize OpenGL rendering */ HDC hDC = GetDC(_hwnd); - if (openglEnabled || !_glSupport) { + if (openglEnabled) { useOpengl = sharedGLContext.init(hDC); } } diff --git a/src/dlangui/platforms/x11/x11app.d b/src/dlangui/platforms/x11/x11app.d index 14b53a54..21fd869e 100644 --- a/src/dlangui/platforms/x11/x11app.d +++ b/src/dlangui/platforms/x11/x11app.d @@ -352,20 +352,11 @@ class X11Window : DWindow { _enableOpengl = false; } else { glXMakeCurrent(x11display, cast(uint)_win, _glc); - if (!_gl3Reloaded) { - DerelictGL3.missingSymbolCallback = &gl3MissingSymFunc; - DerelictGL3.reload(GLVersion.GL21, GLVersion.GL40); - _gl3Reloaded = true; - if (!_glSupport) - _glSupport = new GLSupport(true); - if (!glSupport.valid && !glSupport.initShaders()) - _enableOpengl = false; - glXMakeCurrent(x11display, cast(uint)_win, null); - if (!_enableOpengl && _glc) { - glXDestroyContext(x11display, _glc); - _glc = null; - } - } + _enableOpengl = initGLSupport(_platform.GLVersionMajor < 3); + if (!_enableOpengl && _glc) { + glXDestroyContext(x11display, _glc); + _glc = null; + } } } if (_enableOpengl) {