diff --git a/dlanguilib.visualdproj b/dlanguilib.visualdproj
index f2be6fe3..8b472667 100644
--- a/dlanguilib.visualdproj
+++ b/dlanguilib.visualdproj
@@ -72,7 +72,7 @@
0
DebugFocus FontResources
0
- EmbedStandardResources Unicode USE_FREETYPE USE_OPENGL USE_SDL
+ EmbedStandardResources Unicode USE_FREETYPE USE_OPENGL
0
0
1
diff --git a/examples/example1/example1.visualdproj b/examples/example1/example1.visualdproj
index ae01ea12..1a8dd99c 100644
--- a/examples/example1/example1.visualdproj
+++ b/examples/example1/example1.visualdproj
@@ -173,7 +173,7 @@
0
0
- Unicode USE_FREETYPE USE_SDL
+ Unicode USE_FREETYPE
0
0
0
diff --git a/examples/example1/src/example1.d b/examples/example1/src/example1.d
index 78a9a90d..eb367992 100644
--- a/examples/example1/src/example1.d
+++ b/examples/example1/src/example1.d
@@ -187,6 +187,10 @@ enum : int {
/// entry point for dlangui based application
extern (C) int UIAppMain(string[] args) {
+
+ // always use trace, even for release builds
+ Log.setLogLevel(LogLevel.Trace);
+
// resource directory search paths
// not required if only embedded resources are used
//string[] resourceDirs = [
diff --git a/src/dlangui/graphics/glsupport.d b/src/dlangui/graphics/glsupport.d
index a604d40c..110da6ae 100644
--- a/src/dlangui/graphics/glsupport.d
+++ b/src/dlangui/graphics/glsupport.d
@@ -164,14 +164,21 @@ class GLProgram {
Log.d("Program compiled successfully");
//glDetachShader(program, vertexShader);
//glDetachShader(program, fragmentShader);
+ Log.v("trying glUseProgram(0)");
+ glUseProgram(0);
+ Log.v("before useProgram");
glUseProgram(program);
checkError("glUseProgram " ~ to!string(program));
+ Log.v("after useProgram");
if (!initLocations()) {
Log.e("some of locations were not found");
error = true;
}
initialized = true;
- return true;
+ Log.v("Program is initialized successfully");
+ glUseProgram(0);
+ checkError("glUseProgram " ~ to!string(program));
+ return !error;
}
bool initLocations() {
return true;
@@ -605,27 +612,34 @@ class GLSupport {
}
bool initShaders() {
+ if (_solidFillProgram is null) {
+ Log.v("Compiling solid fill program");
+ _solidFillProgram = new SolidFillProgram();
+ if (!_solidFillProgram.compile())
+ return false;
+ }
if (_textureProgram is null) {
+ Log.v("Compiling texture program");
_textureProgram = new TextureProgram();
if (!_textureProgram.compile())
return false;
}
if (_fontProgram is null) {
+ Log.v("Compiling font program");
_fontProgram = new FontProgram();
if (!_fontProgram.compile())
return false;
}
- if (_solidFillProgram is null) {
- _solidFillProgram = new SolidFillProgram();
- if (!_solidFillProgram.compile())
- return false;
- }
Log.d("Shaders compiled successfully");
return true;
}
bool uninitShaders() {
Log.d("Uniniting shaders");
+ if (_solidFillProgram !is null) {
+ destroy(_solidFillProgram);
+ _solidFillProgram = null;
+ }
if (_textureProgram !is null) {
destroy(_textureProgram);
_textureProgram = null;
@@ -634,10 +648,6 @@ class GLSupport {
destroy(_fontProgram);
_fontProgram = null;
}
- if (_solidFillProgram !is null) {
- destroy(_solidFillProgram);
- _solidFillProgram = null;
- }
return true;
}
diff --git a/src/dlangui/platforms/windows/winapp.d b/src/dlangui/platforms/windows/winapp.d
index 7b6210b7..55dc1ff8 100644
--- a/src/dlangui/platforms/windows/winapp.d
+++ b/src/dlangui/platforms/windows/winapp.d
@@ -222,14 +222,20 @@ class Win32Window : Window {
version (USE_OPENGL) {
//_gl = new GLSupport();
- if (!_glSupport)
+ if (!_glSupport) {
+ Log.v("Creating OpenGL support");
_glSupport = new GLSupport();
+ Log.v("OpenGL support created");
+ }
}
// successful
+ Log.v("initializing shaders");
if (glSupport.valid || glSupport.initShaders()) {
+ Log.v("shaders are ok");
setOpenglEnabled();
useOpengl = true;
+ Log.v("OpenGL is initialized ok");
} else {
Log.e("Failed to compile shaders");
}
@@ -773,10 +779,12 @@ class Win32Platform : Platform {
private Win32Window[ulong] _windowMap;
/// add window to window map
void onWindowCreated(HWND hwnd, Win32Window window) {
+ Log.v("created window, adding to map");
_windowMap[cast(ulong)hwnd] = window;
}
/// remove window from window map, returns true if there are some more windows left in map
bool onWindowDestroyed(HWND hwnd, Win32Window window) {
+ Log.v("destroyed window, removing from map");
Win32Window wnd = getWindow(hwnd);
if (wnd) {
_windowMap.remove(cast(ulong)hwnd);