aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/org/jdesktop/j3d
diff options
context:
space:
mode:
authorkcr <kcr@28c7f869-5b4e-e670-f602-82bfaf57f300>2006-03-03 18:26:39 +0000
committerkcr <kcr@28c7f869-5b4e-e670-f602-82bfaf57f300>2006-03-03 18:26:39 +0000
commit39559cff4972525ec1b40f075bd01ec75fbf10cb (patch)
tree5a30a04e982d9debf1e00f643d7a97ae1ef44a47 /src/classes/org/jdesktop/j3d
parenteeafadd7b12c337319aa85730c2acf0758e14e18 (diff)
Added ShaderErrorListeners
Diffstat (limited to 'src/classes/org/jdesktop/j3d')
-rw-r--r--src/classes/org/jdesktop/j3d/examples/glsl_shader/EnvironmentMappingGLSL.java20
-rw-r--r--src/classes/org/jdesktop/j3d/examples/glsl_shader/ObjLoadGLSL.java12
-rw-r--r--src/classes/org/jdesktop/j3d/examples/glsl_shader/PhongShadingGLSL.java22
-rw-r--r--src/classes/org/jdesktop/j3d/examples/glsl_shader/SamplerTestGLSL.java20
-rw-r--r--src/classes/org/jdesktop/j3d/examples/glsl_shader/ShaderTestGLSL.java26
-rw-r--r--src/classes/org/jdesktop/j3d/examples/glsl_shader/SphereGLSL.java13
-rw-r--r--src/classes/org/jdesktop/j3d/examples/glsl_shader/VertexAttrTestGLSL.java25
7 files changed, 104 insertions, 34 deletions
diff --git a/src/classes/org/jdesktop/j3d/examples/glsl_shader/EnvironmentMappingGLSL.java b/src/classes/org/jdesktop/j3d/examples/glsl_shader/EnvironmentMappingGLSL.java
index bfada86..b5ade60 100644
--- a/src/classes/org/jdesktop/j3d/examples/glsl_shader/EnvironmentMappingGLSL.java
+++ b/src/classes/org/jdesktop/j3d/examples/glsl_shader/EnvironmentMappingGLSL.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 EnvironmentMappingGLSL extends javax.swing.JFrame {
@@ -61,7 +62,7 @@ public class EnvironmentMappingGLSL extends javax.swing.JFrame {
private static final int NUM_TEX_UNITS = 1;
private static final int TEX_UNIT = 0;
- SimpleUniverse u = null;
+ SimpleUniverse univ = null;
public BranchGroup createSceneGraph() {
// Create the root of the branch graph
@@ -163,14 +164,25 @@ public class EnvironmentMappingGLSL 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(EnvironmentMappingGLSL.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/glsl_shader/ObjLoadGLSL.java b/src/classes/org/jdesktop/j3d/examples/glsl_shader/ObjLoadGLSL.java
index baadf8b..034fdf8 100644
--- a/src/classes/org/jdesktop/j3d/examples/glsl_shader/ObjLoadGLSL.java
+++ b/src/classes/org/jdesktop/j3d/examples/glsl_shader/ObjLoadGLSL.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 ObjLoadGLSL 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(ObjLoadGLSL.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/glsl_shader/PhongShadingGLSL.java b/src/classes/org/jdesktop/j3d/examples/glsl_shader/PhongShadingGLSL.java
index 3129954..91cf585 100644
--- a/src/classes/org/jdesktop/j3d/examples/glsl_shader/PhongShadingGLSL.java
+++ b/src/classes/org/jdesktop/j3d/examples/glsl_shader/PhongShadingGLSL.java
@@ -291,17 +291,6 @@ public class PhongShadingGLSL extends javax.swing.JFrame {
rotator2.setSchedulingBounds(bounds);
l2RotTrans.addChild(rotator2);
- // Setup ShaderErrorListener
- univ.addShaderErrorListener(new ShaderErrorListener() {
- public void errorOccurred(ShaderError error) {
- error.printVerbose();
- JOptionPane.showMessageDialog(PhongShadingGLSL.this,
- error.toString(),
- "ShaderError",
- JOptionPane.ERROR_MESSAGE);
- }
- });
-
return objRoot;
}
@@ -313,6 +302,17 @@ public class PhongShadingGLSL extends javax.swing.JFrame {
univ = new SimpleUniverse(c);
+ // Add a ShaderErrorListener
+ univ.addShaderErrorListener(new ShaderErrorListener() {
+ public void errorOccurred(ShaderError error) {
+ error.printVerbose();
+ JOptionPane.showMessageDialog(PhongShadingGLSL.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/glsl_shader/SamplerTestGLSL.java b/src/classes/org/jdesktop/j3d/examples/glsl_shader/SamplerTestGLSL.java
index d7fe88f..2195211 100644
--- a/src/classes/org/jdesktop/j3d/examples/glsl_shader/SamplerTestGLSL.java
+++ b/src/classes/org/jdesktop/j3d/examples/glsl_shader/SamplerTestGLSL.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 SamplerTestGLSL extends javax.swing.JFrame {
@@ -65,7 +66,7 @@ public class SamplerTestGLSL 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
@@ -180,14 +181,25 @@ public class SamplerTestGLSL 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(SamplerTestGLSL.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/glsl_shader/ShaderTestGLSL.java b/src/classes/org/jdesktop/j3d/examples/glsl_shader/ShaderTestGLSL.java
index c7e2809..1d77a8e 100644
--- a/src/classes/org/jdesktop/j3d/examples/glsl_shader/ShaderTestGLSL.java
+++ b/src/classes/org/jdesktop/j3d/examples/glsl_shader/ShaderTestGLSL.java
@@ -51,6 +51,7 @@ import javax.media.j3d.*;
import javax.vecmath.*;
import java.awt.GraphicsConfiguration;
import java.io.IOException;
+import javax.swing.JOptionPane;
import org.jdesktop.j3d.examples.Resources;
public class ShaderTestGLSL extends javax.swing.JFrame {
@@ -71,7 +72,7 @@ public class ShaderTestGLSL extends javax.swing.JFrame {
"BrickColor", "LightPosition"
};
- private SimpleUniverse u = null;
+ private SimpleUniverse univ = null;
private View view;
private BranchGroup transpObj;
private BranchGroup scene = null;
@@ -281,7 +282,7 @@ public class ShaderTestGLSL extends javax.swing.JFrame {
// Create a position interpolator and attach it to the view
// platform
TransformGroup vpTrans =
- u.getViewingPlatform().getViewPlatformTransform();
+ univ.getViewingPlatform().getViewPlatformTransform();
Transform3D axisOfTranslation = new Transform3D();
Alpha transAlpha = new Alpha(-1,
Alpha.INCREASING_ENABLE |
@@ -310,14 +311,25 @@ public class ShaderTestGLSL 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(ShaderTestGLSL.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();
- view = u.getViewer().getView();
+ view = univ.getViewer().getView();
return c;
}
@@ -606,7 +618,7 @@ public class ShaderTestGLSL extends javax.swing.JFrame {
private void AttachButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AttachButtonActionPerformed
if (scene == null) {
scene = createSceneGraph(1);
- u.addBranchGraph(scene);
+ univ.addBranchGraph(scene);
replaceSPButton.setEnabled(true);
shaderSelected = BRICK_SHADER;
}
diff --git a/src/classes/org/jdesktop/j3d/examples/glsl_shader/SphereGLSL.java b/src/classes/org/jdesktop/j3d/examples/glsl_shader/SphereGLSL.java
index 768e38e..66bf311 100644
--- a/src/classes/org/jdesktop/j3d/examples/glsl_shader/SphereGLSL.java
+++ b/src/classes/org/jdesktop/j3d/examples/glsl_shader/SphereGLSL.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;
/**
@@ -276,7 +277,17 @@ public class SphereGLSL 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(SphereGLSL.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/glsl_shader/VertexAttrTestGLSL.java b/src/classes/org/jdesktop/j3d/examples/glsl_shader/VertexAttrTestGLSL.java
index 7fb7484..1f73790 100644
--- a/src/classes/org/jdesktop/j3d/examples/glsl_shader/VertexAttrTestGLSL.java
+++ b/src/classes/org/jdesktop/j3d/examples/glsl_shader/VertexAttrTestGLSL.java
@@ -59,7 +59,7 @@ import org.jdesktop.j3d.examples.Resources;
public class VertexAttrTestGLSL extends javax.swing.JFrame {
- SimpleUniverse universe = null;
+ SimpleUniverse univ = null;
BranchGroup scene = null;
public BranchGroup createSceneGraph( boolean hasVertexAttrs ) {
@@ -88,7 +88,7 @@ public class VertexAttrTestGLSL extends javax.swing.JFrame {
// Create a simple Shape3D node; add it to the scene graph.
objTrans.addChild(new MyShape(this, hasVertexAttrs));
-
+
return objRoot;
}
@@ -97,9 +97,20 @@ public class VertexAttrTestGLSL extends javax.swing.JFrame {
SimpleUniverse.getPreferredConfiguration();
Canvas3D c = new Canvas3D(config);
- universe = new SimpleUniverse(c);
-
- ViewingPlatform viewingPlatform = universe.getViewingPlatform();
+ univ = new SimpleUniverse(c);
+
+ // Add a ShaderErrorListener
+ univ.addShaderErrorListener(new ShaderErrorListener() {
+ public void errorOccurred(ShaderError error) {
+ error.printVerbose();
+ JOptionPane.showMessageDialog(VertexAttrTestGLSL.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();
@@ -343,7 +354,7 @@ public class VertexAttrTestGLSL extends javax.swing.JFrame {
private void destroyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_destroyButtonActionPerformed
if (scene != null) {
- universe.getLocale().removeBranchGraph(scene);
+ univ.getLocale().removeBranchGraph(scene);
scene = null;
}
}//GEN-LAST:event_destroyButtonActionPerformed
@@ -352,7 +363,7 @@ public class VertexAttrTestGLSL extends javax.swing.JFrame {
if (scene == null) {
boolean hasVertexAttrs = vertexAttrsBox.isSelected();
scene = createSceneGraph(hasVertexAttrs);
- universe.addBranchGraph(scene);
+ univ.addBranchGraph(scene);
}
}//GEN-LAST:event_createButtonActionPerformed