From eeafadd7b12c337319aa85730c2acf0758e14e18 Mon Sep 17 00:00:00 2001 From: kcr Date: Fri, 3 Mar 2006 18:07:20 +0000 Subject: 1. Recompressed some images for greater compression 2. Added ShaderErrorListener to phong shading test program --- .../j3d/examples/glsl_shader/PhongShadingGLSL.java | 21 +++++++++++++++++---- src/resources/images/Java3Ddot3.jpg | Bin 0 -> 16302 bytes src/resources/images/bg.jpg | Bin 327485 -> 58084 bytes src/resources/images/gold.jpg | Bin 42643 -> 18253 bytes src/resources/images/mask.jpg | Bin 0 -> 2655 bytes src/resources/images/stone.jpg | Bin 79522 -> 20446 bytes src/resources/images/wood.jpg | Bin 56795 -> 12807 bytes 7 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 src/resources/images/Java3Ddot3.jpg create mode 100644 src/resources/images/mask.jpg 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 diff --git a/src/resources/images/Java3Ddot3.jpg b/src/resources/images/Java3Ddot3.jpg new file mode 100644 index 0000000..011e574 Binary files /dev/null and b/src/resources/images/Java3Ddot3.jpg differ diff --git a/src/resources/images/bg.jpg b/src/resources/images/bg.jpg index 556babe..9790379 100644 Binary files a/src/resources/images/bg.jpg and b/src/resources/images/bg.jpg differ diff --git a/src/resources/images/gold.jpg b/src/resources/images/gold.jpg index 40e8786..aec73c5 100644 Binary files a/src/resources/images/gold.jpg and b/src/resources/images/gold.jpg differ diff --git a/src/resources/images/mask.jpg b/src/resources/images/mask.jpg new file mode 100644 index 0000000..35a6c8d Binary files /dev/null and b/src/resources/images/mask.jpg differ diff --git a/src/resources/images/stone.jpg b/src/resources/images/stone.jpg index ab80a4a..6aa8914 100644 Binary files a/src/resources/images/stone.jpg and b/src/resources/images/stone.jpg differ diff --git a/src/resources/images/wood.jpg b/src/resources/images/wood.jpg index 195b903..99370c5 100644 Binary files a/src/resources/images/wood.jpg and b/src/resources/images/wood.jpg differ -- cgit v1.2.3