diff --git a/core/ChangeLog b/core/ChangeLog index 87738415e..5987e25d5 100644 --- a/core/ChangeLog +++ b/core/ChangeLog @@ -1,3 +1,9 @@ +2012-08-28 Bill Kuker + + * Removed late GL initialization, was causing issues with Java 7. + + * Added -Dopenrocket.3d.disable option for anyone experiencing crashes as a result of OpenGL. + 2012-08-01 Kevin Ruland * Changed the loader to pull *.rkt files from zip containers. diff --git a/core/doc/properties.txt b/core/doc/properties.txt index db4a52faf..c9a44cb40 100644 --- a/core/doc/properties.txt +++ b/core/doc/properties.txt @@ -9,7 +9,8 @@ openrocket.locale Select the default locale to be used, for example "en_US". If set to "xx", the logical keys will be displayed instead of the translated strings. - +openrocket.3d.disable + Disables all OpenGL calls if set. Logging options --------------- diff --git a/core/src/net/sf/openrocket/gui/figure3d/RocketFigure3d.java b/core/src/net/sf/openrocket/gui/figure3d/RocketFigure3d.java index 3e3a98c49..8df1e8508 100644 --- a/core/src/net/sf/openrocket/gui/figure3d/RocketFigure3d.java +++ b/core/src/net/sf/openrocket/gui/figure3d/RocketFigure3d.java @@ -6,8 +6,7 @@ import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.RenderingHints; -import java.awt.event.HierarchyEvent; -import java.awt.event.HierarchyListener; +import java.awt.SplashScreen; import java.awt.event.MouseEvent; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; @@ -86,20 +85,25 @@ public class RocketFigure3d extends JPanel implements GLEventListener { public RocketFigure3d(Configuration config) { this.configuration = config; this.setLayout(new BorderLayout()); - - /** - * This achieves late GL initialization, so that if there is a crash - * it does not occur until user selects 3D view, so as to not render - * the application unusable. - */ - addHierarchyListener(new HierarchyListener() { - @Override - public void hierarchyChanged(HierarchyEvent e) { - log.verbose("GL - Calling initGLCanvas on hierarchy change"); - initGLCanvas(); - RocketFigure3d.this.removeHierarchyListener(this); - } - }); + + //Only initizlize GL if 3d is enabled. + if ( is3dEnabled() ){ + //Fixes a linux / X bug: Splash must be closed before GL Init + SplashScreen splash = SplashScreen.getSplashScreen(); + if ( splash != null ) + splash.close(); + + initGLCanvas(); + } + } + + /** + * Return true if 3d view is enabled. This may be toggled by the user at + * launch time. + * @return + */ + public static boolean is3dEnabled(){ + return System.getProperty("openrocket.3d.disable") == null; } private void initGLCanvas(){ diff --git a/core/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java b/core/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java index ed80812dc..2cef70809 100644 --- a/core/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java +++ b/core/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java @@ -285,9 +285,9 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change } }); bg.add(toggle3d); + toggle3d.setEnabled(RocketFigure3d.is3dEnabled()); add(toggle3d, "gap rel"); - // Zoom level selector scaleSelector = new ScaleSelector(scrollPane); add(scaleSelector);