platform fixes

This commit is contained in:
gazer 2017-06-07 21:52:27 +03:00
parent ee33115bef
commit 167e129f00
5 changed files with 11 additions and 33 deletions

View File

@ -8,6 +8,7 @@ import dlangui.platforms.common.platform;
import dlangui.graphics.drawbuf; import dlangui.graphics.drawbuf;
import dlangui.graphics.fonts; import dlangui.graphics.fonts;
import dlangui.widgets.styles; import dlangui.widgets.styles;
import dlangui.widgets.widget;
import dlangui.platforms.console.consolefont; import dlangui.platforms.console.consolefont;
private import dlangui.platforms.console.dconsole; private import dlangui.platforms.console.dconsole;

View File

@ -76,17 +76,6 @@ class DSFMLWindow : dlangui.platforms.common.platform.Window {
private void paintUsingOpenGL() { private void paintUsingOpenGL() {
import derelict.opengl3.gl3; 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); glDisable(GL_DEPTH_TEST);
glViewport(0, 0, _dx, _dy); glViewport(0, 0, _dx, _dy);
@ -422,11 +411,8 @@ void initDSFMLApp() {
currentTheme = createDefaultTheme(); currentTheme = createDefaultTheme();
import derelict.opengl3.gl3;
import dlangui.graphics.glsupport; import dlangui.graphics.glsupport;
DerelictGL3.load(); initGLSupport(false);
if (!_glSupport)
_glSupport = new GLSupport();
Platform.instance.uiTheme = "theme_dark"; Platform.instance.uiTheme = "theme_dark";
} }

View File

@ -291,8 +291,8 @@ class SDLWindow : Window {
Log.w("OpenGL support is disabled"); Log.w("OpenGL support is disabled");
} }
} }
if (success && !_glSupport) { if (success) {
_enableOpengl = initGLSupport(false); _enableOpengl = initGLSupport(_platform.GLVersionMajor < 3);
fixSize(); fixSize();
} }
} }

View File

@ -183,7 +183,7 @@ static if (ENABLE_OPENGL) {
_hGLRC = wglCreateContext(hDC); _hGLRC = wglCreateContext(hDC);
if (_hGLRC) { if (_hGLRC) {
bind(hDC); bind(hDC);
bool initialized = initGLSupport(false); bool initialized = initGLSupport(Platform.instance.GLVersionMajor < 3);
unbind(hDC); unbind(hDC);
if (!initialized) { if (!initialized) {
uninit(); uninit();
@ -281,7 +281,7 @@ class Win32Window : Window {
/* initialize OpenGL rendering */ /* initialize OpenGL rendering */
HDC hDC = GetDC(_hwnd); HDC hDC = GetDC(_hwnd);
if (openglEnabled || !_glSupport) { if (openglEnabled) {
useOpengl = sharedGLContext.init(hDC); useOpengl = sharedGLContext.init(hDC);
} }
} }

View File

@ -352,20 +352,11 @@ class X11Window : DWindow {
_enableOpengl = false; _enableOpengl = false;
} else { } else {
glXMakeCurrent(x11display, cast(uint)_win, _glc); glXMakeCurrent(x11display, cast(uint)_win, _glc);
if (!_gl3Reloaded) { _enableOpengl = initGLSupport(_platform.GLVersionMajor < 3);
DerelictGL3.missingSymbolCallback = &gl3MissingSymFunc; if (!_enableOpengl && _glc) {
DerelictGL3.reload(GLVersion.GL21, GLVersion.GL40); glXDestroyContext(x11display, _glc);
_gl3Reloaded = true; _glc = null;
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;
}
}
} }
} }
if (_enableOpengl) { if (_enableOpengl) {