aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes
diff options
context:
space:
mode:
authorkcr <kcr@28c7f869-5b4e-e670-f602-82bfaf57f300>2006-03-03 18:07:20 +0000
committerkcr <kcr@28c7f869-5b4e-e670-f602-82bfaf57f300>2006-03-03 18:07:20 +0000
commiteeafadd7b12c337319aa85730c2acf0758e14e18 (patch)
tree4d8fac09c039c87a3dd160a5a75f3d9c5389406a /src/classes
parent748ecffc275b9b5b7b1b66db81b97dbc95f1b308 (diff)
1. Recompressed some images for greater compression
2. Added ShaderErrorListener to phong shading test program
Diffstat (limited to 'src/classes')
-rw-r--r--src/classes/org/jdesktop/j3d/examples/glsl_shader/PhongShadingGLSL.java21
1 files changed, 17 insertions, 4 deletions
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 50b68fc..3129954 100644
--- a/src/classes/org/jdesktop/j3d/examples/glsl_shader/PhongShadingGLSL.java
+++ b/src/classes/org/jdesktop/j3d/examples/glsl_shader/PhongShadingGLSL.java
@@ -48,6 +48,7 @@ import com.sun.j3d.utils.geometry.Sphere;
import com.sun.j3d.utils.shader.StringIO;
import com.sun.j3d.utils.universe.*;
import javax.media.j3d.*;
+import javax.swing.JOptionPane;
import javax.vecmath.*;
import java.awt.GraphicsConfiguration;
import java.io.IOException;
@@ -67,7 +68,7 @@ public class PhongShadingGLSL extends javax.swing.JFrame {
// Flag indicates type of lights: directional, point, or spot lights.
private static int lightType = DIRECTIONAL_LIGHT;
- private SimpleUniverse u = null;
+ private SimpleUniverse univ = null;
private ShaderAppearance sApp = null;
private ShaderProgram gouraudSP = null;
@@ -290,6 +291,17 @@ 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;
}
@@ -299,14 +311,14 @@ public class PhongShadingGLSL extends javax.swing.JFrame {
Canvas3D c = new Canvas3D(config);
- u = new SimpleUniverse(c);
+ univ = new SimpleUniverse(c);
// This will move the ViewPlatform back a bit so the
// objects in the scene can be viewed.
- u.getViewingPlatform().setNominalViewingTransform();
+ univ.getViewingPlatform().setNominalViewingTransform();
BranchGroup scene = createSceneGraph();
- u.addBranchGraph(scene);
+ univ.addBranchGraph(scene);
return c;
}
@@ -323,6 +335,7 @@ public class PhongShadingGLSL extends javax.swing.JFrame {
drawingPanel.add(c, java.awt.BorderLayout.CENTER);
}
+
// ----------------------------------------------------------------
/** This method is called from within the constructor to