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.fonts;
import dlangui.widgets.styles;
import dlangui.widgets.widget;
import dlangui.platforms.console.consolefont;
private import dlangui.platforms.console.dconsole;

View File

@ -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";
}

View File

@ -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();
}
}

View File

@ -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);
}
}

View File

@ -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) {