aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkcr <kcr@28c7f869-5b4e-e670-f602-82bfaf57f300>2006-03-03 18:40:28 +0000
committerkcr <kcr@28c7f869-5b4e-e670-f602-82bfaf57f300>2006-03-03 18:40:28 +0000
commit5059e87f5d6d7785ad2959ac0e3d4f48988686a5 (patch)
tree6f8518df889ebd80eb270487cafa0ba00b9e1771
parent39559cff4972525ec1b40f075bd01ec75fbf10cb (diff)
Added a ShaderErrorListener
-rw-r--r--src/classes/org/jdesktop/j3d/examples/cg_shader/ObjLoadCg.java12
-rw-r--r--src/classes/org/jdesktop/j3d/examples/cg_shader/SamplerTestCg.java20
-rw-r--r--src/classes/org/jdesktop/j3d/examples/cg_shader/SphereCg.java13
-rw-r--r--src/classes/org/jdesktop/j3d/examples/cg_shader/VertexAttrTestCg.java23
4 files changed, 57 insertions, 11 deletions
diff --git a/src/classes/org/jdesktop/j3d/examples/cg_shader/ObjLoadCg.java b/src/classes/org/jdesktop/j3d/examples/cg_shader/ObjLoadCg.java
index bdb859d..1e10b8d 100644
--- a/src/classes/org/jdesktop/j3d/examples/cg_shader/ObjLoadCg.java
+++ b/src/classes/org/jdesktop/j3d/examples/cg_shader/ObjLoadCg.java
@@ -59,6 +59,7 @@ import java.io.*;
import java.net.URL;
import com.sun.j3d.utils.behaviors.vp.*;
import java.io.FileNotFoundException;
+import javax.swing.JOptionPane;
import org.jdesktop.j3d.examples.Resources;
/**
@@ -179,6 +180,17 @@ public class ObjLoadCg extends javax.swing.JFrame {
univ = new SimpleUniverse(canvas3d);
BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
+ // Add a ShaderErrorListener
+ univ.addShaderErrorListener(new ShaderErrorListener() {
+ public void errorOccurred(ShaderError error) {
+ error.printVerbose();
+ JOptionPane.showMessageDialog(ObjLoadCg.this,
+ error.toString(),
+ "ShaderError",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ });
+
// add mouse behaviors to the ViewingPlatform
ViewingPlatform viewingPlatform = univ.getViewingPlatform();
diff --git a/src/classes/org/jdesktop/j3d/examples/cg_shader/SamplerTestCg.java b/src/classes/org/jdesktop/j3d/examples/cg_shader/SamplerTestCg.java
index 757b02e..f34185e 100644
--- a/src/classes/org/jdesktop/j3d/examples/cg_shader/SamplerTestCg.java
+++ b/src/classes/org/jdesktop/j3d/examples/cg_shader/SamplerTestCg.java
@@ -53,6 +53,7 @@ import javax.vecmath.*;
import java.awt.GraphicsConfiguration;
import java.io.IOException;
import java.net.URL;
+import javax.swing.JOptionPane;
import org.jdesktop.j3d.examples.Resources;
public class SamplerTestCg extends javax.swing.JFrame {
@@ -65,7 +66,7 @@ public class SamplerTestCg extends javax.swing.JFrame {
private static final int CLOUD = 0;
private static final int EARTH = 1;
- SimpleUniverse u = null;
+ SimpleUniverse univ = null;
public BranchGroup createSceneGraph() {
// Create the root of the branch graph
@@ -176,14 +177,25 @@ public class SamplerTestCg extends javax.swing.JFrame {
Canvas3D c = new Canvas3D(config);
BranchGroup scene = createSceneGraph();
- u = new SimpleUniverse(c);
+ univ = new SimpleUniverse(c);
+
+ // Add a ShaderErrorListener
+ univ.addShaderErrorListener(new ShaderErrorListener() {
+ public void errorOccurred(ShaderError error) {
+ error.printVerbose();
+ JOptionPane.showMessageDialog(SamplerTestCg.this,
+ error.toString(),
+ "ShaderError",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ });
- ViewingPlatform viewingPlatform = u.getViewingPlatform();
+ ViewingPlatform viewingPlatform = univ.getViewingPlatform();
// This will move the ViewPlatform back a bit so the
// objects in the scene can be viewed.
viewingPlatform.setNominalViewingTransform();
- u.addBranchGraph(scene);
+ univ.addBranchGraph(scene);
return c;
}
diff --git a/src/classes/org/jdesktop/j3d/examples/cg_shader/SphereCg.java b/src/classes/org/jdesktop/j3d/examples/cg_shader/SphereCg.java
index 1d7b1b1..51becfc 100644
--- a/src/classes/org/jdesktop/j3d/examples/cg_shader/SphereCg.java
+++ b/src/classes/org/jdesktop/j3d/examples/cg_shader/SphereCg.java
@@ -51,6 +51,7 @@ import javax.media.j3d.*;
import javax.vecmath.*;
import java.awt.GraphicsConfiguration;
import java.io.*;
+import javax.swing.JOptionPane;
import org.jdesktop.j3d.examples.Resources;
/**
@@ -277,7 +278,17 @@ public class SphereCg extends javax.swing.JFrame {
univ = new SimpleUniverse(canvas3d);
BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
-
+ // Add a ShaderErrorListener
+ univ.addShaderErrorListener(new ShaderErrorListener() {
+ public void errorOccurred(ShaderError error) {
+ error.printVerbose();
+ JOptionPane.showMessageDialog(SphereCg.this,
+ error.toString(),
+ "ShaderError",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ });
+
// This will move the ViewPlatform back a bit so the
// objects in the scene can be viewed.
univ.getViewingPlatform().setNominalViewingTransform();
diff --git a/src/classes/org/jdesktop/j3d/examples/cg_shader/VertexAttrTestCg.java b/src/classes/org/jdesktop/j3d/examples/cg_shader/VertexAttrTestCg.java
index b724efa..e191259 100644
--- a/src/classes/org/jdesktop/j3d/examples/cg_shader/VertexAttrTestCg.java
+++ b/src/classes/org/jdesktop/j3d/examples/cg_shader/VertexAttrTestCg.java
@@ -60,7 +60,7 @@ import org.jdesktop.j3d.examples.Resources;
public class VertexAttrTestCg extends javax.swing.JFrame {
- SimpleUniverse u = null;
+ SimpleUniverse univ = null;
BranchGroup scene = null;
public BranchGroup createSceneGraph(boolean hasVertexAttrs) {
@@ -99,9 +99,20 @@ public class VertexAttrTestCg extends javax.swing.JFrame {
Canvas3D c = new Canvas3D(config);
- u = new SimpleUniverse(c);
-
- ViewingPlatform viewingPlatform = u.getViewingPlatform();
+ univ = new SimpleUniverse(c);
+
+ // Add a ShaderErrorListener
+ univ.addShaderErrorListener(new ShaderErrorListener() {
+ public void errorOccurred(ShaderError error) {
+ error.printVerbose();
+ JOptionPane.showMessageDialog(VertexAttrTestCg.this,
+ error.toString(),
+ "ShaderError",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ });
+
+ ViewingPlatform viewingPlatform = univ.getViewingPlatform();
// This will move the ViewPlatform back a bit so the
// objects in the scene can be viewed.
viewingPlatform.setNominalViewingTransform();
@@ -342,7 +353,7 @@ public class VertexAttrTestCg extends javax.swing.JFrame {
private void destroyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_destroyButtonActionPerformed
if (scene != null) {
- u.getLocale().removeBranchGraph(scene);
+ univ.getLocale().removeBranchGraph(scene);
scene = null;
}
}//GEN-LAST:event_destroyButtonActionPerformed
@@ -351,7 +362,7 @@ public class VertexAttrTestCg extends javax.swing.JFrame {
if (scene == null) {
boolean hasVertexAttrs = vertexAttrsBox.isSelected();
scene = createSceneGraph(hasVertexAttrs);
- u.addBranchGraph(scene);
+ univ.addBranchGraph(scene);
}
}//GEN-LAST:event_createButtonActionPerformed