Merge pull request #146 from bkuker/bugfix-osx-java7
GL Preferences for compatibility - specifically with Java 7 on OSX.
This commit is contained in:
commit
0a4ca9fe54
@ -26,7 +26,7 @@
|
|||||||
<classpathentry kind="lib" path="lib/javax.inject.jar"/>
|
<classpathentry kind="lib" path="lib/javax.inject.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/aopalliance.jar"/>
|
<classpathentry kind="lib" path="lib/aopalliance.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jogl/gluegen-rt.jar" sourcepath="reference/gluegen-v2.0-rc11-sources.jar"/>
|
<classpathentry kind="lib" path="lib/jogl/gluegen-rt.jar" sourcepath="reference/gluegen-v2.0-rc11-sources.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jogl/jogl-all.jar" sourcepath="reference/jogl-v2.0-rc11-sources.jar"/>
|
<classpathentry kind="lib" path="lib/jogl/jogl-all.jar" sourcepath="reference/jogl-all-2.0.2-sources.jar"/>
|
||||||
<classpathentry kind="lib" path="lib-test/test-plugin.jar"/>
|
<classpathentry kind="lib" path="lib-test/test-plugin.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/annotation-detector-3.0.2-SNAPSHOT.jar"/>
|
<classpathentry kind="lib" path="lib/annotation-detector-3.0.2-SNAPSHOT.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/logback-classic-1.0.12.jar" sourcepath="reference/logback-classic-1.0.12-sources.jar"/>
|
<classpathentry kind="lib" path="lib/logback-classic-1.0.12.jar" sourcepath="reference/logback-classic-1.0.12-sources.jar"/>
|
||||||
|
BIN
core/reference/jogl-all-2.0.2-sources.jar
Normal file
BIN
core/reference/jogl-all-2.0.2-sources.jar
Normal file
Binary file not shown.
Binary file not shown.
@ -253,7 +253,15 @@ pref.dlg.tab.Materials = Materials
|
|||||||
pref.dlg.tab.Custommaterials = Custom materials
|
pref.dlg.tab.Custommaterials = Custom materials
|
||||||
pref.dlg.tab.Options = Options
|
pref.dlg.tab.Options = Options
|
||||||
pref.dlg.tab.Miscellaneousoptions = Miscellaneous options
|
pref.dlg.tab.Miscellaneousoptions = Miscellaneous options
|
||||||
pref.dlg.tab.DecalEditor = Graphics Editor
|
|
||||||
|
pref.dlg.tab.Graphics = Graphics
|
||||||
|
pref.dlg.lbl.DecalEditor = Graphics Editor
|
||||||
|
pref.dlg.opengl.lbl.title = 3D Graphics
|
||||||
|
pref.dlg.opengl.but.enableGL = Enable 3D Graphics
|
||||||
|
pref.dlg.opengl.but.enableAA = Enable Antialiasing
|
||||||
|
pref.dlg.opengl.lbl.useFBO = Use Off-screen Rendering
|
||||||
|
|
||||||
|
|
||||||
pref.dlg.lbl.Positiontoinsert = Position to insert new body components:
|
pref.dlg.lbl.Positiontoinsert = Position to insert new body components:
|
||||||
pref.dlg.lbl.Confirmdeletion = Confirm deletion of simulations:
|
pref.dlg.lbl.Confirmdeletion = Confirm deletion of simulations:
|
||||||
pref.dlg.lbl.User-definedthrust = User-defined thrust curves:
|
pref.dlg.lbl.User-definedthrust = User-defined thrust curves:
|
||||||
|
@ -16,6 +16,7 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import javax.swing.AbstractListModel;
|
import javax.swing.AbstractListModel;
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.ButtonGroup;
|
import javax.swing.ButtonGroup;
|
||||||
import javax.swing.ComboBoxModel;
|
import javax.swing.ComboBoxModel;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
@ -29,10 +30,10 @@ import javax.swing.JPanel;
|
|||||||
import javax.swing.JProgressBar;
|
import javax.swing.JProgressBar;
|
||||||
import javax.swing.JRadioButton;
|
import javax.swing.JRadioButton;
|
||||||
import javax.swing.JTabbedPane;
|
import javax.swing.JTabbedPane;
|
||||||
import javax.swing.JTextArea;
|
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.Timer;
|
import javax.swing.Timer;
|
||||||
|
import javax.swing.border.TitledBorder;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
import javax.swing.event.DocumentEvent;
|
import javax.swing.event.DocumentEvent;
|
||||||
@ -41,6 +42,7 @@ import javax.swing.event.DocumentListener;
|
|||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import net.sf.openrocket.communication.UpdateInfo;
|
import net.sf.openrocket.communication.UpdateInfo;
|
||||||
import net.sf.openrocket.communication.UpdateInfoRetriever;
|
import net.sf.openrocket.communication.UpdateInfoRetriever;
|
||||||
|
import net.sf.openrocket.gui.adaptors.BooleanModel;
|
||||||
import net.sf.openrocket.gui.components.DescriptionArea;
|
import net.sf.openrocket.gui.components.DescriptionArea;
|
||||||
import net.sf.openrocket.gui.components.StyledLabel;
|
import net.sf.openrocket.gui.components.StyledLabel;
|
||||||
import net.sf.openrocket.gui.components.StyledLabel.Style;
|
import net.sf.openrocket.gui.components.StyledLabel.Style;
|
||||||
@ -62,6 +64,8 @@ import net.sf.openrocket.util.Utils;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.itextpdf.text.Font;
|
||||||
|
|
||||||
|
|
||||||
public class PreferencesDialog extends JDialog {
|
public class PreferencesDialog extends JDialog {
|
||||||
private static final Logger log = LoggerFactory.getLogger(PreferencesDialog.class);
|
private static final Logger log = LoggerFactory.getLogger(PreferencesDialog.class);
|
||||||
@ -92,7 +96,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
tabbedPane.addTab(trans.get("pref.dlg.tab.Options"), null, optionsPane(),
|
tabbedPane.addTab(trans.get("pref.dlg.tab.Options"), null, optionsPane(),
|
||||||
trans.get("pref.dlg.tab.Miscellaneousoptions"));
|
trans.get("pref.dlg.tab.Miscellaneousoptions"));
|
||||||
//// Decal Editor selection
|
//// Decal Editor selection
|
||||||
tabbedPane.addTab(trans.get("pref.dlg.tab.DecalEditor"), decalEditorPane());
|
tabbedPane.addTab(trans.get("pref.dlg.tab.Graphics"), graphicsOptionsPane());
|
||||||
|
|
||||||
//// Close button
|
//// Close button
|
||||||
JButton close = new JButton(trans.get("dlg.but.close"));
|
JButton close = new JButton(trans.get("dlg.but.close"));
|
||||||
@ -471,9 +475,15 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private JPanel decalEditorPane() {
|
private JPanel graphicsOptionsPane() {
|
||||||
|
|
||||||
JPanel panel = new JPanel(new MigLayout("fillx, ins 30lp n n n"));
|
JPanel panel = new JPanel(new MigLayout("fillx"));
|
||||||
|
|
||||||
|
panel.add(new JPanel(new MigLayout("fill, ins n n n")) {
|
||||||
|
{ //Editor Options
|
||||||
|
TitledBorder border = BorderFactory.createTitledBorder(trans.get("pref.dlg.lbl.DecalEditor"));
|
||||||
|
GUIUtil.changeFontStyle(border, Font.BOLD);
|
||||||
|
setBorder(border);
|
||||||
|
|
||||||
ButtonGroup execGroup = new ButtonGroup();
|
ButtonGroup execGroup = new ButtonGroup();
|
||||||
|
|
||||||
@ -487,7 +497,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(showPrompt, "wrap");
|
add(showPrompt, "wrap");
|
||||||
execGroup.add(showPrompt);
|
execGroup.add(showPrompt);
|
||||||
|
|
||||||
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.EDIT)) {
|
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.EDIT)) {
|
||||||
@ -502,7 +512,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
panel.add(systemRadio, "wrap");
|
add(systemRadio, "wrap");
|
||||||
execGroup.add(systemRadio);
|
execGroup.add(systemRadio);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -510,10 +520,10 @@ public class PreferencesDialog extends JDialog {
|
|||||||
boolean commandLineIsSelected = preferences.isDecalEditorPreferenceSet() && !preferences.isDecalEditorPreferenceSystem();
|
boolean commandLineIsSelected = preferences.isDecalEditorPreferenceSet() && !preferences.isDecalEditorPreferenceSystem();
|
||||||
final JRadioButton commandRadio = new JRadioButton(trans.get("EditDecalDialog.lbl.cmdline"));
|
final JRadioButton commandRadio = new JRadioButton(trans.get("EditDecalDialog.lbl.cmdline"));
|
||||||
commandRadio.setSelected(commandLineIsSelected);
|
commandRadio.setSelected(commandLineIsSelected);
|
||||||
panel.add(commandRadio, "wrap");
|
add(commandRadio, "wrap");
|
||||||
execGroup.add(commandRadio);
|
execGroup.add(commandRadio);
|
||||||
|
|
||||||
final JTextArea commandText = new JTextArea();
|
final JTextField commandText = new JTextField();
|
||||||
commandText.setEnabled(commandLineIsSelected);
|
commandText.setEnabled(commandLineIsSelected);
|
||||||
commandText.setText(commandLineIsSelected ? preferences.getDecalEditorCommandLine() : "");
|
commandText.setText(commandLineIsSelected ? preferences.getDecalEditorCommandLine() : "");
|
||||||
commandText.getDocument().addDocumentListener(new DocumentListener() {
|
commandText.getDocument().addDocumentListener(new DocumentListener() {
|
||||||
@ -534,7 +544,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
panel.add(commandText, "growx, wrap");
|
add(commandText, "growx, wrap");
|
||||||
|
|
||||||
final JButton chooser = new JButton(trans.get("EditDecalDialog.btn.chooser"));
|
final JButton chooser = new JButton(trans.get("EditDecalDialog.btn.chooser"));
|
||||||
chooser.setEnabled(commandLineIsSelected);
|
chooser.setEnabled(commandLineIsSelected);
|
||||||
@ -553,7 +563,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
panel.add(chooser, "growx, wrap");
|
add(chooser, "wrap");
|
||||||
|
|
||||||
|
|
||||||
commandRadio.addChangeListener(new ChangeListener() {
|
commandRadio.addChangeListener(new ChangeListener() {
|
||||||
@ -566,13 +576,59 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}, "growx, span");
|
||||||
|
|
||||||
|
panel.add(new JPanel(new MigLayout("fill, ins n n n")) {
|
||||||
|
{/////GL Options
|
||||||
|
TitledBorder border = BorderFactory.createTitledBorder(trans.get("pref.dlg.opengl.lbl.title"));
|
||||||
|
GUIUtil.changeFontStyle(border, Font.BOLD);
|
||||||
|
setBorder(border);
|
||||||
|
|
||||||
|
//// The effects will take place the next time you open a window.
|
||||||
|
add(new StyledLabel(
|
||||||
|
trans.get("pref.dlg.lbl.effect1"), -2, Style.ITALIC),
|
||||||
|
"spanx, wrap");
|
||||||
|
|
||||||
|
BooleanModel enableGLModel = new BooleanModel(preferences.getBoolean(Preferences.OPENGL_ENABLED, true));
|
||||||
|
final JCheckBox enableGL = new JCheckBox(enableGLModel);
|
||||||
|
enableGL.setText(trans.get("pref.dlg.opengl.but.enableGL"));
|
||||||
|
enableGL.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
preferences.putBoolean(Preferences.OPENGL_ENABLED, enableGL.isSelected());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
add(enableGL, "wrap");
|
||||||
|
|
||||||
|
final JCheckBox enableAA = new JCheckBox(trans.get("pref.dlg.opengl.but.enableAA"));
|
||||||
|
enableAA.setSelected(preferences.getBoolean(Preferences.OPENGL_ENABLE_AA, true));
|
||||||
|
enableAA.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
preferences.putBoolean(Preferences.OPENGL_ENABLE_AA, enableAA.isSelected());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
enableGLModel.addEnableComponent(enableAA);
|
||||||
|
add(enableAA, "wrap");
|
||||||
|
|
||||||
|
final JCheckBox useFBO = new JCheckBox(trans.get("pref.dlg.opengl.lbl.useFBO"));
|
||||||
|
useFBO.setSelected(preferences.getBoolean(Preferences.OPENGL_USE_FBO, false));
|
||||||
|
useFBO.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
preferences.putBoolean(Preferences.OPENGL_USE_FBO, useFBO.isSelected());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
enableGLModel.addEnableComponent(useFBO);
|
||||||
|
add(useFBO, "wrap");
|
||||||
|
}
|
||||||
|
}, "growx, span");
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private class DefaultUnitSelector extends AbstractListModel implements ComboBoxModel {
|
private class DefaultUnitSelector extends AbstractListModel implements ComboBoxModel {
|
||||||
|
|
||||||
private final UnitGroup group;
|
private final UnitGroup group;
|
||||||
|
@ -127,12 +127,13 @@ public class RealisticRenderer extends RocketRenderer {
|
|||||||
g.render(gl);
|
g.render(gl);
|
||||||
|
|
||||||
if (decals && t != null && tex != null) {
|
if (decals && t != null && tex != null) {
|
||||||
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR);
|
|
||||||
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
|
|
||||||
|
|
||||||
tex.enable(gl);
|
tex.enable(gl);
|
||||||
tex.bind(gl);
|
tex.bind(gl);
|
||||||
|
|
||||||
|
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR);
|
||||||
|
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
|
||||||
|
|
||||||
gl.glMatrixMode(GL.GL_TEXTURE);
|
gl.glMatrixMode(GL.GL_TEXTURE);
|
||||||
gl.glPushMatrix();
|
gl.glPushMatrix();
|
||||||
|
|
||||||
@ -170,6 +171,7 @@ public class RealisticRenderer extends RocketRenderer {
|
|||||||
gl.glMatrixMode(GL.GL_TEXTURE);
|
gl.glMatrixMode(GL.GL_TEXTURE);
|
||||||
gl.glPopMatrix();
|
gl.glPopMatrix();
|
||||||
gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
|
gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
|
||||||
|
|
||||||
tex.disable(gl);
|
tex.disable(gl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package net.sf.openrocket.gui.figure3d;
|
|||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
@ -23,6 +24,7 @@ import javax.media.opengl.GLEventListener;
|
|||||||
import javax.media.opengl.GLProfile;
|
import javax.media.opengl.GLProfile;
|
||||||
import javax.media.opengl.GLRunnable;
|
import javax.media.opengl.GLRunnable;
|
||||||
import javax.media.opengl.awt.GLCanvas;
|
import javax.media.opengl.awt.GLCanvas;
|
||||||
|
import javax.media.opengl.awt.GLJPanel;
|
||||||
import javax.media.opengl.fixedfunc.GLLightingFunc;
|
import javax.media.opengl.fixedfunc.GLLightingFunc;
|
||||||
import javax.media.opengl.fixedfunc.GLMatrixFunc;
|
import javax.media.opengl.fixedfunc.GLMatrixFunc;
|
||||||
import javax.media.opengl.glu.GLU;
|
import javax.media.opengl.glu.GLU;
|
||||||
@ -39,6 +41,8 @@ import net.sf.openrocket.gui.figureelements.FigureElement;
|
|||||||
import net.sf.openrocket.gui.main.Splash;
|
import net.sf.openrocket.gui.main.Splash;
|
||||||
import net.sf.openrocket.rocketcomponent.Configuration;
|
import net.sf.openrocket.rocketcomponent.Configuration;
|
||||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||||
|
import net.sf.openrocket.startup.Application;
|
||||||
|
import net.sf.openrocket.startup.Preferences;
|
||||||
import net.sf.openrocket.util.Coordinate;
|
import net.sf.openrocket.util.Coordinate;
|
||||||
import net.sf.openrocket.util.MathUtil;
|
import net.sf.openrocket.util.MathUtil;
|
||||||
|
|
||||||
@ -71,8 +75,7 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
|
|||||||
|
|
||||||
private final OpenRocketDocument document;
|
private final OpenRocketDocument document;
|
||||||
private final Configuration configuration;
|
private final Configuration configuration;
|
||||||
private GLCanvas canvas;
|
private Component canvas;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private Overlay extrasOverlay, caretOverlay;
|
private Overlay extrasOverlay, caretOverlay;
|
||||||
@ -109,7 +112,7 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void flushTextureCaches() {
|
public void flushTextureCaches() {
|
||||||
canvas.invoke(true, new GLRunnable() {
|
((GLAutoDrawable) canvas).invoke(true, new GLRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public boolean run(GLAutoDrawable drawable) {
|
public boolean run(GLAutoDrawable drawable) {
|
||||||
rr.flushTextureCache(drawable);
|
rr.flushTextureCache(drawable);
|
||||||
@ -124,7 +127,11 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean is3dEnabled() {
|
public static boolean is3dEnabled() {
|
||||||
return System.getProperty("openrocket.3d.disable") == null;
|
//Allow disable by command line, if program won't even start
|
||||||
|
if (System.getProperty("openrocket.3d.disable") != null)
|
||||||
|
return false;
|
||||||
|
//return by preference
|
||||||
|
return Application.getPreferences().getBoolean(Preferences.OPENGL_ENABLED, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initGLCanvas() {
|
private void initGLCanvas() {
|
||||||
@ -138,17 +145,26 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
|
|||||||
log.trace("GL - creating GLCapabilities");
|
log.trace("GL - creating GLCapabilities");
|
||||||
final GLCapabilities caps = new GLCapabilities(glp);
|
final GLCapabilities caps = new GLCapabilities(glp);
|
||||||
|
|
||||||
|
if (Application.getPreferences().getBoolean(Preferences.OPENGL_ENABLE_AA, true)) {
|
||||||
log.trace("GL - setSampleBuffers");
|
log.trace("GL - setSampleBuffers");
|
||||||
caps.setSampleBuffers(true);
|
caps.setSampleBuffers(true);
|
||||||
|
|
||||||
log.trace("GL - setNumSamples");
|
log.trace("GL - setNumSamples");
|
||||||
caps.setNumSamples(6);
|
caps.setNumSamples(6);
|
||||||
|
} else {
|
||||||
|
log.trace("GL - Not enabling AA by user pref");
|
||||||
|
}
|
||||||
|
|
||||||
log.trace("GL - Creating Canvas");
|
if (Application.getPreferences().getBoolean(Preferences.OPENGL_USE_FBO, false)) {
|
||||||
|
log.trace("GL - Creating GLJPanel");
|
||||||
|
canvas = new GLJPanel(caps);
|
||||||
|
} else {
|
||||||
|
log.trace("GL - Creating GLCanvas");
|
||||||
canvas = new GLCanvas(caps);
|
canvas = new GLCanvas(caps);
|
||||||
|
}
|
||||||
|
|
||||||
log.trace("GL - Registering as GLEventListener on canvas");
|
log.trace("GL - Registering as GLEventListener on canvas");
|
||||||
canvas.addGLEventListener(this);
|
((GLAutoDrawable) canvas).addGLEventListener(this);
|
||||||
|
|
||||||
log.trace("GL - Adding canvas to this JPanel");
|
log.trace("GL - Adding canvas to this JPanel");
|
||||||
this.add(canvas, BorderLayout.CENTER);
|
this.add(canvas, BorderLayout.CENTER);
|
||||||
@ -306,6 +322,10 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
|
|||||||
|
|
||||||
drawExtras(gl, glu);
|
drawExtras(gl, glu);
|
||||||
drawCarets(gl, glu);
|
drawCarets(gl, glu);
|
||||||
|
|
||||||
|
//GLJPanel with GLSL Flipper relies on this:
|
||||||
|
gl.glFrontFace(GL.GL_CCW);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -532,7 +552,7 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
|
|||||||
log.debug("3D Figure Updated");
|
log.debug("3D Figure Updated");
|
||||||
cachedBounds = null;
|
cachedBounds = null;
|
||||||
if (canvas != null) {
|
if (canvas != null) {
|
||||||
canvas.invoke(true, new GLRunnable() {
|
((GLAutoDrawable) canvas).invoke(true, new GLRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public boolean run(GLAutoDrawable drawable) {
|
public boolean run(GLAutoDrawable drawable) {
|
||||||
rr.updateFigure(drawable);
|
rr.updateFigure(drawable);
|
||||||
@ -543,9 +563,10 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void internalRepaint() {
|
private void internalRepaint() {
|
||||||
|
if (canvas != null) {
|
||||||
|
((GLAutoDrawable) canvas).display();
|
||||||
|
}
|
||||||
super.repaint();
|
super.repaint();
|
||||||
if (canvas != null)
|
|
||||||
canvas.display();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -677,15 +698,19 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
|
|||||||
newRR = new FigureRenderer();
|
newRR = new FigureRenderer();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!canvas.isRealized()) {
|
if (canvas instanceof GLCanvas && !((GLCanvas) canvas).isRealized()) {
|
||||||
|
rr = newRR;
|
||||||
|
} else if (canvas instanceof GLJPanel && !((GLJPanel) canvas).isRealized()) {
|
||||||
rr = newRR;
|
rr = newRR;
|
||||||
} else {
|
} else {
|
||||||
canvas.invoke(true, new GLRunnable() {
|
((GLAutoDrawable) canvas).invoke(true, new GLRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public boolean run(GLAutoDrawable drawable) {
|
public boolean run(GLAutoDrawable drawable) {
|
||||||
rr.dispose(drawable);
|
rr.dispose(drawable);
|
||||||
rr = newRR;
|
rr = newRR;
|
||||||
newRR.init(drawable);
|
newRR.init(drawable);
|
||||||
|
if (canvas instanceof GLJPanel)
|
||||||
|
internalRepaint();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -83,11 +83,16 @@ public abstract class RocketRenderer {
|
|||||||
|
|
||||||
ByteBuffer bb = ByteBuffer.allocateDirect(4);
|
ByteBuffer bb = ByteBuffer.allocateDirect(4);
|
||||||
|
|
||||||
|
if (p == null)
|
||||||
|
return null; //Allow pick to be called without a point for debugging
|
||||||
|
|
||||||
gl.glReadPixels(p.x, p.y, 1, 1, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, bb);
|
gl.glReadPixels(p.x, p.y, 1, 1, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, bb);
|
||||||
|
|
||||||
final int pickColor = bb.getInt();
|
final int pickColor = bb.getInt();
|
||||||
final int pickIndex = ((pickColor >> 20) & 0xF00) | ((pickColor >> 16) & 0x0F0) | ((pickColor >> 12) & 0x00F);
|
final int pickIndex = ((pickColor >> 20) & 0xF00) | ((pickColor >> 16) & 0x0F0) | ((pickColor >> 12) & 0x00F);
|
||||||
|
|
||||||
|
log.trace("Picked pixel color is {} index is {}", pickColor, pickIndex);
|
||||||
|
|
||||||
if (pickIndex < 0 || pickIndex > pickParts.size() - 1)
|
if (pickIndex < 0 || pickIndex > pickParts.size() - 1)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -50,6 +50,11 @@ public abstract class Preferences {
|
|||||||
public static final String PREFERRED_THRUST_CURVE_MOTOR_NODE = "preferredThrustCurveMotors";
|
public static final String PREFERRED_THRUST_CURVE_MOTOR_NODE = "preferredThrustCurveMotors";
|
||||||
private static final String AUTO_OPEN_LAST_DESIGN = "AUTO_OPEN_LAST_DESIGN";
|
private static final String AUTO_OPEN_LAST_DESIGN = "AUTO_OPEN_LAST_DESIGN";
|
||||||
|
|
||||||
|
//Preferences related to 3D graphics
|
||||||
|
public static final String OPENGL_ENABLED = "OpenGL_Is_Enabled";
|
||||||
|
public static final String OPENGL_ENABLE_AA = "OpenGL_Antialiasing_Is_Enabled";
|
||||||
|
public static final String OPENGL_USE_FBO = "OpenGL_Use_FBO";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ******************************************************************************************
|
* ******************************************************************************************
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user