summaryrefslogtreecommitdiffstats
path: root/src/demos/cg/runtime_ogl
diff options
context:
space:
mode:
Diffstat (limited to 'src/demos/cg/runtime_ogl')
-rw-r--r--src/demos/cg/runtime_ogl/cgGL_vertex_example.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/demos/cg/runtime_ogl/cgGL_vertex_example.java b/src/demos/cg/runtime_ogl/cgGL_vertex_example.java
index ec2cb9a..f1f41dd 100644
--- a/src/demos/cg/runtime_ogl/cgGL_vertex_example.java
+++ b/src/demos/cg/runtime_ogl/cgGL_vertex_example.java
@@ -31,11 +31,14 @@
*
*/
+package demos.cg.runtime_ogl;
+
import net.java.games.cg.*;
import net.java.games.jogl.*;
import java.awt.*;
import java.awt.event.*;
+import java.io.*;
/**
* cgGL_vertex_example: simple demo of Nvidia CgGL API. Based upon C version
@@ -187,9 +190,14 @@ public class cgGL_vertex_example implements GLEventListener
CheckCgError();
/* Test adding source text to context */
- Program = CgGL.cgCreateProgramFromFile(
- Context, CgGL.CG_SOURCE, "cgGL_vertex_example.cg",
- profile, null, null);
+ try {
+ Program = CgGL.cgCreateProgramFromStream(
+ Context, CgGL.CG_SOURCE,
+ getClass().getClassLoader().getResourceAsStream("demos/cg/runtime_ogl/cgGL_vertex_example.cg"),
+ profile, null, null);
+ } catch (IOException e) {
+ throw new RuntimeException("Error loading Cg vertex program", e);
+ }
CheckCgError();
System.err.println(