|
@@ -30,14 +30,25 @@ class Window {
|
|
|
win = winCreate(@:privateAccess title.toUtf8(), width, height);
|
|
|
if( win == null ) throw "Failed to create window";
|
|
|
glctx = winGetGLContext(win);
|
|
|
- if( glctx == null )
|
|
|
- throw "Failed to init GL Context (OpenGL 3.2+ required)";
|
|
|
- if( !GL.init() )
|
|
|
- throw "Failed to init GL API";
|
|
|
+ if( glctx == null || !GL.init() ) {
|
|
|
+ destroy();
|
|
|
+ onGlContextError();
|
|
|
+ }
|
|
|
windows.push(this);
|
|
|
vsync = true;
|
|
|
}
|
|
|
|
|
|
+ public static dynamic function onGlContextError() {
|
|
|
+ var devices = Sdl.getDevices();
|
|
|
+ var device = devices[0];
|
|
|
+ if( device == null ) device = "Unknown";
|
|
|
+ var flags = new haxe.EnumFlags<hl.UI.DialogFlags>();
|
|
|
+ flags.set(IsError);
|
|
|
+ var msg = 'The application was unable to create an OpenGL context\nfor your $device video card.\nOpenGL 3.2+ is required, please update your driver.';
|
|
|
+ hl.UI.dialog("OpenGL Error", msg, flags);
|
|
|
+ Sys.exit(-1);
|
|
|
+ }
|
|
|
+
|
|
|
function set_displayMode(mode) {
|
|
|
if( mode == displayMode )
|
|
|
return mode;
|