diff options
author | Kenneth Russel <[email protected]> | 2005-05-13 23:57:50 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-05-13 23:57:50 +0000 |
commit | 7ac0aeff0fb6208a048588d9c83c941a82c64ed7 (patch) | |
tree | 519c460f0b298f7bef8845938535703853989fb2 /src/demos/cg/runtime_ogl_vertex_fragment | |
parent | 4a225f43a1f5f8a2ae95d3e3696c79e9090260e8 (diff) |
Added CgGL.cgCreateProgramFromStream and updated JOGL Cg demos to use
it so they can be run with Java Web Start.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/trunk@74 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos/cg/runtime_ogl_vertex_fragment')
-rw-r--r-- | src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java index d0b7dc1..0c389e1 100644 --- a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java +++ b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java @@ -31,6 +31,8 @@ * */ +package demos.cg.runtime_ogl_vertex_fragment; + import net.java.games.cg.*; import net.java.games.jogl.*; import net.java.games.jogl.util.*; @@ -235,8 +237,13 @@ public class runtime_ogl_vertex_fragment implements GLEventListener // Load and compile the vertex program from demo_vert.cg; hold on to the // handle to it that is returned. - vertexProgram = CgGL.cgCreateProgramFromFile(context, CgGL.CG_SOURCE, "demo_vert.cg", - vertexProfile, null, null); + try { + vertexProgram = CgGL.cgCreateProgramFromStream(context, CgGL.CG_SOURCE, + getClass().getClassLoader().getResourceAsStream("demos/cg/runtime_ogl_vertex_fragment/demo_vert.cg"), + vertexProfile, null, null); + } catch (IOException e) { + throw new RuntimeException("Error loading Cg vertex program", e); + } if (!CgGL.cgIsProgramCompiled(vertexProgram)) CgGL.cgCompileProgram(vertexProgram); @@ -245,8 +252,13 @@ public class runtime_ogl_vertex_fragment implements GLEventListener CgGL.cgGLLoadProgram(vertexProgram); // And similarly set things up for the fragment program. - fragmentProgram = CgGL.cgCreateProgramFromFile(context, CgGL.CG_SOURCE, "demo_frag.cg", - fragmentProfile, null, null); + try { + fragmentProgram = CgGL.cgCreateProgramFromStream(context, CgGL.CG_SOURCE, + getClass().getClassLoader().getResourceAsStream("demos/cg/runtime_ogl_vertex_fragment/demo_frag.cg"), + fragmentProfile, null, null); + } catch (IOException e) { + throw new RuntimeException("Error loading Cg fragment program", e); + } if (!CgGL.cgIsProgramCompiled(fragmentProgram)) { CgGL.cgCompileProgram(fragmentProgram); } |