diff options
author | kcr <kcr@28c7f869-5b4e-e670-f602-82bfaf57f300> | 2005-04-08 18:02:30 +0000 |
---|---|---|
committer | kcr <kcr@28c7f869-5b4e-e670-f602-82bfaf57f300> | 2005-04-08 18:02:30 +0000 |
commit | a1d93a902e47cb799b04735867c80dd3984d2301 (patch) | |
tree | c92e959c38be32660d37d1847a2995fad6f2cf99 | |
parent | 0370c70b959e638811a2eb37eac60fa979a8c276 (diff) |
Updated the examples to use the new SourceCodeShader class.
-rw-r--r-- | src/CgShaderTest/ObjLoadCg.java | 14 | ||||
-rw-r--r-- | src/CgShaderTest/SphereCg.java | 14 | ||||
-rw-r--r-- | src/GLSLShaderTest/ObjLoadGLSL.java | 14 | ||||
-rw-r--r-- | src/GLSLShaderTest/SphereGLSL.java | 14 |
4 files changed, 36 insertions, 20 deletions
diff --git a/src/CgShaderTest/ObjLoadCg.java b/src/CgShaderTest/ObjLoadCg.java index 8d48bce..0cef002 100644 --- a/src/CgShaderTest/ObjLoadCg.java +++ b/src/CgShaderTest/ObjLoadCg.java @@ -124,11 +124,15 @@ public class ObjLoadCg extends Applet { e.printStackTrace(); System.exit(1); } - CgVertexShader vertexShader = new CgVertexShader(vertexProgram); - CgFragmentShader fragmentShader = new CgFragmentShader(fragmentProgram); - CgShaderProgram shaderProgram = new CgShaderProgram(); - shaderProgram.setVertexShader(vertexShader); - shaderProgram.setFragmentShader(fragmentShader); + Shader[] shaders = new Shader[2]; + shaders[0] = new SourceCodeShader(Shader.SHADING_LANGUAGE_CG, + Shader.SHADER_TYPE_VERTEX, + vertexProgram); + shaders[1] = new SourceCodeShader(Shader.SHADING_LANGUAGE_CG, + Shader.SHADER_TYPE_FRAGMENT, + fragmentProgram); + ShaderProgram shaderProgram = new CgShaderProgram(); + shaderProgram.setShaders(shaders); setShaderProgram(s.getSceneGroup(), shaderProgram); objTrans.addChild(s.getSceneGroup()); diff --git a/src/CgShaderTest/SphereCg.java b/src/CgShaderTest/SphereCg.java index a5664ce..266d523 100644 --- a/src/CgShaderTest/SphereCg.java +++ b/src/CgShaderTest/SphereCg.java @@ -121,11 +121,15 @@ public class SphereCg extends Applet { e.printStackTrace(); System.exit(1); } - CgVertexShader vertexShader = new CgVertexShader(vertexProgram); - CgFragmentShader fragmentShader = new CgFragmentShader(fragmentProgram); - CgShaderProgram shaderProgram = new CgShaderProgram(); - shaderProgram.setVertexShader(vertexShader); - shaderProgram.setFragmentShader(fragmentShader); + Shader[] shaders = new Shader[2]; + shaders[0] = new SourceCodeShader(Shader.SHADING_LANGUAGE_CG, + Shader.SHADER_TYPE_VERTEX, + vertexProgram); + shaders[1] = new SourceCodeShader(Shader.SHADING_LANGUAGE_CG, + Shader.SHADER_TYPE_FRAGMENT, + fragmentProgram); + ShaderProgram shaderProgram = new CgShaderProgram(); + shaderProgram.setShaders(shaders); a.setShaderProgram(shaderProgram); a.setMaterial(m); diff --git a/src/GLSLShaderTest/ObjLoadGLSL.java b/src/GLSLShaderTest/ObjLoadGLSL.java index 354f912..3abfbae 100644 --- a/src/GLSLShaderTest/ObjLoadGLSL.java +++ b/src/GLSLShaderTest/ObjLoadGLSL.java @@ -124,11 +124,15 @@ public class ObjLoadGLSL extends Applet { e.printStackTrace(); System.exit(1); } - GLSLVertexShader vertexShader = new GLSLVertexShader(vertexProgram); - GLSLFragmentShader fragmentShader = new GLSLFragmentShader(fragmentProgram); - GLSLShaderProgram shaderProgram = new GLSLShaderProgram(); - shaderProgram.setVertexShader(vertexShader); - shaderProgram.setFragmentShader(fragmentShader); + Shader[] shaders = new Shader[2]; + shaders[0] = new SourceCodeShader(Shader.SHADING_LANGUAGE_GLSL, + Shader.SHADER_TYPE_VERTEX, + vertexProgram); + shaders[1] = new SourceCodeShader(Shader.SHADING_LANGUAGE_GLSL, + Shader.SHADER_TYPE_FRAGMENT, + fragmentProgram); + ShaderProgram shaderProgram = new GLSLShaderProgram(); + shaderProgram.setShaders(shaders); setShaderProgram(s.getSceneGroup(), shaderProgram); objTrans.addChild(s.getSceneGroup()); diff --git a/src/GLSLShaderTest/SphereGLSL.java b/src/GLSLShaderTest/SphereGLSL.java index 4ad34b8..ca9717c 100644 --- a/src/GLSLShaderTest/SphereGLSL.java +++ b/src/GLSLShaderTest/SphereGLSL.java @@ -124,11 +124,15 @@ public class SphereGLSL extends Applet { */ System.err.println(e); } - GLSLVertexShader vertexShader = new GLSLVertexShader(vertexProgram); - GLSLFragmentShader fragmentShader = new GLSLFragmentShader(fragmentProgram); - GLSLShaderProgram shaderProgram = new GLSLShaderProgram(); - shaderProgram.setVertexShader(vertexShader); - shaderProgram.setFragmentShader(fragmentShader); + Shader[] shaders = new Shader[2]; + shaders[0] = new SourceCodeShader(Shader.SHADING_LANGUAGE_GLSL, + Shader.SHADER_TYPE_VERTEX, + vertexProgram); + shaders[1] = new SourceCodeShader(Shader.SHADING_LANGUAGE_GLSL, + Shader.SHADER_TYPE_FRAGMENT, + fragmentProgram); + ShaderProgram shaderProgram = new GLSLShaderProgram(); + shaderProgram.setShaders(shaders); a.setShaderProgram(shaderProgram); a.setMaterial(m); |