correct win32 opengl initialization - possible fixes issue #81

This commit is contained in:
Vadim Lopatin 2015-03-31 10:23:14 +03:00
parent 10aa79f479
commit 433263133c
2 changed files with 18 additions and 19 deletions

View File

@ -72,7 +72,7 @@
<debuglevel>0</debuglevel> <debuglevel>0</debuglevel>
<debugids>DebugFocus FontResources</debugids> <debugids>DebugFocus FontResources</debugids>
<versionlevel>0</versionlevel> <versionlevel>0</versionlevel>
<versionids>EmbedStandardResources Unicode USE_FREETYPE USE_OPENGL USE_DSFML</versionids> <versionids>EmbedStandardResources Unicode USE_FREETYPE USE_OPENGL</versionids>
<dump_source>0</dump_source> <dump_source>0</dump_source>
<mapverbosity>0</mapverbosity> <mapverbosity>0</mapverbosity>
<createImplib>1</createImplib> <createImplib>1</createImplib>

View File

@ -178,11 +178,6 @@ class Win32Window : Window {
if (!_dy) if (!_dy)
_dy = 400; _dy = 400;
_platform = platform; _platform = platform;
version (USE_OPENGL) {
//_gl = new GLSupport();
if (!_glSupport)
_glSupport = new GLSupport();
}
_caption = windowCaption; _caption = windowCaption;
_flags = flags; _flags = flags;
uint ws = WS_CLIPCHILDREN | WS_CLIPSIBLINGS; uint ws = WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
@ -225,6 +220,12 @@ class Win32Window : Window {
import derelict.opengl3.gl3; import derelict.opengl3.gl3;
DerelictGL3.reload(); DerelictGL3.reload();
version (USE_OPENGL) {
//_gl = new GLSupport();
if (!_glSupport)
_glSupport = new GLSupport();
}
// successful // successful
if (glSupport.valid || glSupport.initShaders()) { if (glSupport.valid || glSupport.initShaders()) {
setOpenglEnabled(); setOpenglEnabled();
@ -233,8 +234,6 @@ class Win32Window : Window {
Log.e("Failed to compile shaders"); Log.e("Failed to compile shaders");
} }
destroy(_glSupport);
_glSupport = null;
} catch (Exception e) { } catch (Exception e) {
Log.e("Derelict exception", e); Log.e("Derelict exception", e);
} }
@ -977,17 +976,17 @@ int myWinMain(void* hInstance, void* hPrevInstance, char* lpCmdLine, int iCmdSho
try { try {
import derelict.opengl3.gl3; import derelict.opengl3.gl3;
DerelictGL3.load(); DerelictGL3.load();
//
// just to check OpenGL context //// just to check OpenGL context
Log.i("Trying to setup OpenGL context"); //Log.i("Trying to setup OpenGL context");
Win32Window tmpWindow = new Win32Window(w32platform, ""d, null, 0); //Win32Window tmpWindow = new Win32Window(w32platform, ""d, null, 0);
destroy(tmpWindow); //destroy(tmpWindow);
if (openglEnabled) //if (openglEnabled)
Log.i("OpenGL support is enabled"); // Log.i("OpenGL support is enabled");
else //else
Log.w("OpenGL support is disabled"); // Log.w("OpenGL support is disabled");
// process messages //// process messages
platform.enterMessageLoop(); //platform.enterMessageLoop();
} catch (Exception e) { } catch (Exception e) {
Log.e("Exception while trying to init OpenGL", e); Log.e("Exception while trying to init OpenGL", e);
setOpenglEnabled(false); setOpenglEnabled(false);