Catch errors when initializing OpenGL and allow them to be displayed to

the user.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3573 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2005-05-24 17:48:10 +00:00
parent 04bd9c768a
commit 56deaa4982
+21 -1
View File
@@ -86,9 +86,13 @@ public class JmeApp
* to begin the rendering/event loop. Derived classes can override * to begin the rendering/event loop. Derived classes can override
* this, being sure to call super before doing their own * this, being sure to call super before doing their own
* initalization. * initalization.
*
* @return true if the application initialized successfully, false if
* initialization failed. (See {@link #reportInitFailure}.)
*/ */
public void init () public boolean init ()
{ {
try {
// load up our renderer configuration // load up our renderer configuration
_properties = new PropertiesIO(getConfigPath("jme.cfg")); _properties = new PropertiesIO(getConfigPath("jme.cfg"));
readDisplayConfig(); readDisplayConfig();
@@ -129,6 +133,13 @@ public class JmeApp
_stats.updateGeometricState(0f, true); _stats.updateGeometricState(0f, true);
_stats.updateRenderState(); _stats.updateRenderState();
} }
return true;
} catch (Exception e) {
reportInitFailure(e);
return false;
}
} }
/** /**
@@ -327,6 +338,15 @@ public class JmeApp
InputSystem.getMouseInput().setCursorVisible(true); InputSystem.getMouseInput().setCursorVisible(true);
} }
/**
* Called when initialization fails to give the application a chance
* to report the failure to the user.
*/
protected void reportInitFailure (Exception e)
{
Log.logStackTrace(e);
}
/** /**
* Processes a single frame. * Processes a single frame.
*/ */