- add panel to configure SDK OpenGL settings

- allow using OpenGL1 for SDK
- allow switching to lwjgl canvas for SDK

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8369 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent 97743331f7
commit 1b540e8837
  1. 9
      sdk/jme3-core/nbproject/project.xml
  2. 8
      sdk/jme3-core/src/com/jme3/gde/core/assets/nodes/ProjectAssetsNode.java
  3. 6
      sdk/jme3-core/src/com/jme3/gde/core/options/Bundle.properties
  4. 103
      sdk/jme3-core/src/com/jme3/gde/core/options/OpenGLOptionsPanelController.java
  5. 111
      sdk/jme3-core/src/com/jme3/gde/core/options/OpenGLPanel.form
  6. 142
      sdk/jme3-core/src/com/jme3/gde/core/options/OpenGLPanel.java
  7. BIN
      sdk/jme3-core/src/com/jme3/gde/core/options/opengl-48.gif
  8. 44
      sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java
  9. 5
      sdk/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java

@ -88,6 +88,15 @@
<specification-version>0.52.2.8.8.2</specification-version> <specification-version>0.52.2.8.8.2</specification-version>
</run-dependency> </run-dependency>
</dependency> </dependency>
<dependency>
<code-name-base>org.netbeans.modules.options.api</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.22</specification-version>
</run-dependency>
</dependency>
<dependency> <dependency>
<code-name-base>org.netbeans.modules.project.ant</code-name-base> <code-name-base>org.netbeans.modules.project.ant</code-name-base>
<build-prerequisite/> <build-prerequisite/>

@ -41,7 +41,6 @@ import org.openide.nodes.FilterNode;
import org.openide.nodes.Node; import org.openide.nodes.Node;
import org.openide.util.ImageUtilities; import org.openide.util.ImageUtilities;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.openide.util.lookup.Lookups;
import org.openide.util.lookup.ProxyLookup; import org.openide.util.lookup.ProxyLookup;
/** /**
@ -55,6 +54,13 @@ public class ProjectAssetsNode extends FilterNode {
public ProjectAssetsNode(ProjectAssetManager manager, Project proj, Node node) throws DataObjectNotFoundException { public ProjectAssetsNode(ProjectAssetManager manager, Project proj, Node node) throws DataObjectNotFoundException {
super(node, new AssetChildren(manager, node), createLookupProxy(manager, node)); super(node, new AssetChildren(manager, node), createLookupProxy(manager, node));
// for (Iterator<Class<? extends Object>> it = proj.getLookup().lookupResult(Object.class).allClasses().iterator(); it.hasNext();) {
// Class<? extends Object> class1 = it.next();
// System.out.println("Clazz: "+class1.getName());
// }
// proj.getLookup().lookup(ProjectClassPathProvider.class).findClassPath(null, ClassPath.EXECUTE);
// proj.getLookup().lookup(AntProjectHelper.class).getProperties(PROP_NAME);
// proj.getLookup().lookup(ProjectClassPathModifier.class).#
enableDelegation(DELEGATE_GET_ACTIONS); enableDelegation(DELEGATE_GET_ACTIONS);
enableDelegation(DELEGATE_GET_CONTEXT_ACTIONS); enableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
setDisplayName("Project Assets"); setDisplayName("Project Assets");

@ -0,0 +1,6 @@
OptionsCategory_Keywords_OpenGL=opengl, graphics
OptionsCategory_Name_OpenGL=OpenGL
OpenGLPanel.jCheckBox1.text=Allow Using OpenGL1
OpenGLPanel.jTextArea1.text=This allows the OpenGL windows of the SDK to be opened on OpenGL1 devices. Be warned however, the output of the windows will not necessarily show what users with OpenGL2 compatible graphics cards will see. Restart the SDK to apply the change.
OpenGLPanel.jCheckBox2.text=Use Heavyweight Canvas
OpenGLPanel.jTextArea2.text=This uses the heavyweight lwjgl canvas for the OpenGL window which should provide better rendering performance but might introduce instability issues and Swing ui incompatibilities on some systems. Restart the SDK to apply the change.

@ -0,0 +1,103 @@
/*
* Copyright (c) 2009-2010 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jme3.gde.core.options;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import javax.swing.JComponent;
import org.netbeans.spi.options.OptionsPanelController;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
@OptionsPanelController.TopLevelRegistration(categoryName = "#OptionsCategory_Name_OpenGL",
iconBase = "com/jme3/gde/core/options/opengl-48.gif",
keywords = "#OptionsCategory_Keywords_OpenGL",
keywordsCategory = "OpenGL")
public final class OpenGLOptionsPanelController extends OptionsPanelController {
private OpenGLPanel panel;
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
private boolean changed;
public void update() {
getPanel().load();
changed = false;
}
public void applyChanges() {
getPanel().store();
changed = false;
}
public void cancel() {
// need not do anything special, if no changes have been persisted yet
}
public boolean isValid() {
return getPanel().valid();
}
public boolean isChanged() {
return changed;
}
public HelpCtx getHelpCtx() {
return null; // new HelpCtx("...ID") if you have a help set
}
public JComponent getComponent(Lookup masterLookup) {
return getPanel();
}
public void addPropertyChangeListener(PropertyChangeListener l) {
pcs.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
pcs.removePropertyChangeListener(l);
}
private OpenGLPanel getPanel() {
if (panel == null) {
panel = new OpenGLPanel(this);
}
return panel;
}
void changed() {
if (!changed) {
changed = true;
pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
}
pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
}
}

@ -0,0 +1,111 @@
<?xml version="1.1" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jCheckBox2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane1" alignment="0" pref="370" max="32767" attributes="0"/>
<Component id="jCheckBox1" alignment="0" pref="370" max="32767" attributes="0"/>
<Component id="jScrollPane2" alignment="1" pref="370" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jCheckBox1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jCheckBox2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane2" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="61" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JCheckBox" name="jCheckBox1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/options/Bundle.properties" key="OpenGLPanel.jCheckBox1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="jTextArea1">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="editable" type="boolean" value="false"/>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="rows" type="int" value="5"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/options/Bundle.properties" key="OpenGLPanel.jTextArea1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="wrapStyleWord" type="boolean" value="true"/>
<Property name="disabledTextColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="0" type="rgb"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JCheckBox" name="jCheckBox2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/options/Bundle.properties" key="OpenGLPanel.jCheckBox2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="jTextArea2">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="editable" type="boolean" value="false"/>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="rows" type="int" value="5"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/options/Bundle.properties" key="OpenGLPanel.jTextArea2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="wrapStyleWord" type="boolean" value="true"/>
<Property name="disabledTextColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="0" type="rgb"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

@ -0,0 +1,142 @@
/*
* Copyright (c) 2009-2010 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jme3.gde.core.options;
import com.jme3.gde.core.Installer;
import org.openide.util.NbPreferences;
final class OpenGLPanel extends javax.swing.JPanel {
private final OpenGLOptionsPanelController controller;
OpenGLPanel(OpenGLOptionsPanelController controller) {
this.controller = controller;
initComponents();
// TODO listen to changes in form fields and call controller.changed()
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jCheckBox1 = new javax.swing.JCheckBox();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jCheckBox2 = new javax.swing.JCheckBox();
jScrollPane2 = new javax.swing.JScrollPane();
jTextArea2 = new javax.swing.JTextArea();
org.openide.awt.Mnemonics.setLocalizedText(jCheckBox1, org.openide.util.NbBundle.getMessage(OpenGLPanel.class, "OpenGLPanel.jCheckBox1.text")); // NOI18N
jTextArea1.setColumns(20);
jTextArea1.setEditable(false);
jTextArea1.setLineWrap(true);
jTextArea1.setRows(5);
jTextArea1.setText(org.openide.util.NbBundle.getMessage(OpenGLPanel.class, "OpenGLPanel.jTextArea1.text")); // NOI18N
jTextArea1.setWrapStyleWord(true);
jTextArea1.setDisabledTextColor(new java.awt.Color(0, 0, 0));
jScrollPane1.setViewportView(jTextArea1);
org.openide.awt.Mnemonics.setLocalizedText(jCheckBox2, org.openide.util.NbBundle.getMessage(OpenGLPanel.class, "OpenGLPanel.jCheckBox2.text")); // NOI18N
jTextArea2.setColumns(20);
jTextArea2.setEditable(false);
jTextArea2.setLineWrap(true);
jTextArea2.setRows(5);
jTextArea2.setText(org.openide.util.NbBundle.getMessage(OpenGLPanel.class, "OpenGLPanel.jTextArea2.text")); // NOI18N
jTextArea2.setWrapStyleWord(true);
jTextArea2.setDisabledTextColor(new java.awt.Color(0, 0, 0));
jScrollPane2.setViewportView(jTextArea2);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jCheckBox2)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 370, Short.MAX_VALUE)
.addComponent(jCheckBox1, javax.swing.GroupLayout.DEFAULT_SIZE, 370, Short.MAX_VALUE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 370, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jCheckBox1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jCheckBox2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(61, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
void load() {
jCheckBox1.setSelected("true".equals(NbPreferences.forModule(Installer.class).get("use_opengl_1", "false")));
jCheckBox2.setSelected("true".equals(NbPreferences.forModule(Installer.class).get("use_lwjgl_canvas", "false")));
}
void store() {
if(jCheckBox1.isSelected()){
NbPreferences.forModule(Installer.class).put("use_opengl_1", "true");
}else{
NbPreferences.forModule(Installer.class).put("use_opengl_1", "false");
}
if(jCheckBox2.isSelected()){
NbPreferences.forModule(Installer.class).put("use_lwjgl_canvas", "true");
}else{
NbPreferences.forModule(Installer.class).put("use_lwjgl_canvas", "false");
}
}
boolean valid() {
// TODO check whether form is consistent and complete
return true;
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JCheckBox jCheckBox2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextArea jTextArea2;
// End of variables declaration//GEN-END:variables
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

@ -28,6 +28,7 @@ import com.jme3.app.Application;
import com.jme3.app.StatsView; import com.jme3.app.StatsView;
import com.jme3.font.BitmapFont; import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText; import com.jme3.font.BitmapText;
import com.jme3.gde.core.Installer;
import com.jme3.gde.core.assets.AssetData; import com.jme3.gde.core.assets.AssetData;
import com.jme3.gde.core.scene.controller.AbstractCameraController; import com.jme3.gde.core.scene.controller.AbstractCameraController;
import com.jme3.gde.core.sceneexplorer.nodes.JmeSpatial; import com.jme3.gde.core.sceneexplorer.nodes.JmeSpatial;
@ -48,9 +49,11 @@ import com.jme3.scene.Node;
import com.jme3.scene.Spatial; import com.jme3.scene.Spatial;
import com.jme3.scene.Spatial.CullHint; import com.jme3.scene.Spatial.CullHint;
import com.jme3.system.AppSettings; import com.jme3.system.AppSettings;
import com.jme3.system.JmeCanvasContext;
import com.jme3.system.awt.AwtPanel; import com.jme3.system.awt.AwtPanel;
import com.jme3.system.awt.AwtPanelsContext; import com.jme3.system.awt.AwtPanelsContext;
import com.jme3.system.awt.PaintMode; import com.jme3.system.awt.PaintMode;
import java.awt.Component;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
@ -70,6 +73,7 @@ import org.openide.util.HelpCtx;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.openide.util.LookupEvent; import org.openide.util.LookupEvent;
import org.openide.util.LookupListener; import org.openide.util.LookupListener;
import org.openide.util.NbPreferences;
import org.openide.util.Utilities; import org.openide.util.Utilities;
import org.openide.util.lookup.Lookups; import org.openide.util.lookup.Lookups;
@ -113,13 +117,20 @@ public class SceneApplication extends Application implements LookupProvider, Loo
private boolean started = false; private boolean started = false;
private AwtPanel panel; private AwtPanel panel;
private ViewPort overlayView; private ViewPort overlayView;
boolean useCanvas = false;
public SceneApplication() { public SceneApplication() {
progressHandle.start(7); progressHandle.start(7);
useCanvas = "true".equals(NbPreferences.forModule(Installer.class).get("use_lwjgl_canvas", "false"));
try { try {
AppSettings newSetting = new AppSettings(true); AppSettings newSetting = new AppSettings(true);
newSetting.setCustomRenderer(AwtPanelsContext.class);
newSetting.setFrameRate(30); newSetting.setFrameRate(30);
if ("true".equals(NbPreferences.forModule(Installer.class).get("use_opengl_1", "false"))) {
newSetting.setRenderer(AppSettings.LWJGL_OPENGL_ANY);
}
if (!useCanvas) {
newSetting.setCustomRenderer(AwtPanelsContext.class);
}
setSettings(newSetting); setSettings(newSetting);
Logger.getLogger("com.jme3").addHandler(logHandler); Logger.getLogger("com.jme3").addHandler(logHandler);
@ -129,9 +140,10 @@ public class SceneApplication extends Application implements LookupProvider, Loo
//add listener for project selection //add listener for project selection
nodeSelectionResult = Utilities.actionsGlobalContext().lookupResult(JmeSpatial.class); nodeSelectionResult = Utilities.actionsGlobalContext().lookupResult(JmeSpatial.class);
nodeSelectionResult.addLookupListener(this); nodeSelectionResult.addLookupListener(this);
// createCanvas(); if (useCanvas) {
// startCanvas(true); createCanvas();
startCanvas(true);
}
progressHandle.progress("initialize Base Application", 1); progressHandle.progress("initialize Base Application", 1);
} catch (Exception e) { } catch (Exception e) {
getProgressHandle().finish(); getProgressHandle().finish();
@ -142,19 +154,25 @@ public class SceneApplication extends Application implements LookupProvider, Loo
SceneViewerTopComponent.showOpenGLError(e.toString()); SceneViewerTopComponent.showOpenGLError(e.toString());
Exceptions.printStackTrace(e); Exceptions.printStackTrace(e);
} }
start(); if (!useCanvas) {
start();
}
} }
public AwtPanel getMainPanel() { public Component getMainPanel() {
if (panel == null) { if (useCanvas) {
panel = ((AwtPanelsContext) getContext()).createPanel(PaintMode.Accelerated); return ((JmeCanvasContext)getContext()).getCanvas();
panel.attachTo(viewPort, overlayView, guiViewPort); } else {
((AwtPanelsContext) getContext()).setInputSource(panel); if (panel == null) {
panel = ((AwtPanelsContext) getContext()).createPanel(PaintMode.Accelerated);
panel.attachTo(viewPort, overlayView, guiViewPort);
((AwtPanelsContext) getContext()).setInputSource(panel);
}
return panel;
} }
return panel;
} }
public ViewPort getOverlayView(){ public ViewPort getOverlayView() {
return overlayView; return overlayView;
} }

@ -29,8 +29,7 @@ import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.scene.SceneRequest; import com.jme3.gde.core.scene.SceneRequest;
import com.jme3.input.awt.AwtKeyInput; import com.jme3.input.awt.AwtKeyInput;
import com.jme3.input.event.KeyInputEvent; import com.jme3.input.event.KeyInputEvent;
import com.jme3.system.awt.AwtPanel; import java.awt.Component;
import com.jme3.system.awt.AwtPanelsContext;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.KeyListener; import java.awt.event.KeyListener;
import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelEvent;
@ -65,7 +64,7 @@ public final class SceneViewerTopComponent extends TopComponent {
private SceneApplication app; private SceneApplication app;
private HelpCtx helpContext = new HelpCtx("com.jme3.gde.core.sceneviewer"); private HelpCtx helpContext = new HelpCtx("com.jme3.gde.core.sceneviewer");
// private Canvas oglCanvas; // private Canvas oglCanvas;
private AwtPanel oglCanvas; private Component oglCanvas;
public SceneViewerTopComponent() { public SceneViewerTopComponent() {
initComponents(); initComponents();

Loading…
Cancel
Save