mirror of https://github.com/buggins/dlangui.git
example1: GlGears - trying on OSX
This commit is contained in:
parent
872b77241b
commit
d2049653ba
|
@ -180,7 +180,7 @@ class Window {
|
|||
_mainWidget.window = this;
|
||||
}
|
||||
|
||||
// Abstract methods : override in platform implementation
|
||||
// Abstract methods : override in platform implementatino
|
||||
|
||||
/// show window
|
||||
abstract void show();
|
||||
|
@ -1375,6 +1375,11 @@ static if (ENABLE_OPENGL) {
|
|||
else
|
||||
glyphDestroyCallback = null;
|
||||
}
|
||||
} else {
|
||||
@property bool openglEnabled() { return false; }
|
||||
void setOpenglEnabled(bool enabled = true) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
version (Windows) {
|
||||
|
|
|
@ -84,7 +84,8 @@ class SDLWindow : Window {
|
|||
_dx = width;
|
||||
_dy = height;
|
||||
create(flags);
|
||||
}
|
||||
Log.i(_enableOpengl ? "OpenGL is enabled" : "OpenGL is disabled");
|
||||
}
|
||||
|
||||
~this() {
|
||||
debug Log.d("Destroying SDL window");
|
||||
|
@ -152,7 +153,7 @@ class SDLWindow : Window {
|
|||
windowFlags |= SDL_WINDOW_OPENGL;
|
||||
if (!_glSupport) {
|
||||
version(OSX) {
|
||||
bool useLegacyOpengl = true;
|
||||
bool useLegacyOpengl = false; //true;
|
||||
} else {
|
||||
bool useLegacyOpengl = false;
|
||||
}
|
||||
|
@ -182,6 +183,7 @@ class SDLWindow : Window {
|
|||
|
||||
static if (ENABLE_OPENGL) {
|
||||
if (_enableOpengl) {
|
||||
Log.i("Trying to create OpenGL 3.2 context");
|
||||
createContext(3, 2);
|
||||
//_context = SDL_GL_CreateContext(_win); // Create the actual context and make it current
|
||||
if (!_context) {
|
||||
|
@ -199,11 +201,14 @@ class SDLWindow : Window {
|
|||
}
|
||||
if (_context && !_gl3Reloaded) {
|
||||
try {
|
||||
Log.d("Reloading DerelictGL3");
|
||||
DerelictGL3.missingSymbolCallback = &gl3MissingSymFunc;
|
||||
DerelictGL3.reload(GLVersion.GL21, GLVersion.GL40);
|
||||
_gl3Reloaded = true;
|
||||
if (!glSupport.valid && !glSupport.initShaders())
|
||||
if (!glSupport.valid && !glSupport.initShaders()) {
|
||||
Log.e("Failed to initialize OpenGL - disabling OpenGL support");
|
||||
_enableOpengl = false;
|
||||
}
|
||||
fixSize();
|
||||
} catch (derelict.util.exception.SymbolLoadException e) {
|
||||
Log.e("Exception in DerelictGL3.reload ", e);
|
||||
|
@ -220,6 +225,7 @@ class SDLWindow : Window {
|
|||
}
|
||||
fixSize();
|
||||
}
|
||||
setOpenglEnabled(_enableOpengl);
|
||||
windowCaption = _caption;
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue