summaryrefslogtreecommitdiffstats
path: root/make/config/jogl/cg-common-CustomJavaCode.java
diff options
context:
space:
mode:
Diffstat (limited to 'make/config/jogl/cg-common-CustomJavaCode.java')
-rwxr-xr-xmake/config/jogl/cg-common-CustomJavaCode.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/make/config/jogl/cg-common-CustomJavaCode.java b/make/config/jogl/cg-common-CustomJavaCode.java
index d1e4f8bf5..cdaa6f2b2 100755
--- a/make/config/jogl/cg-common-CustomJavaCode.java
+++ b/make/config/jogl/cg-common-CustomJavaCode.java
@@ -1,7 +1,26 @@
+private static DynamicLookupHelper cgDynamicLookupHelper;
+private static CgProcAddressTable cgProcAddressTable;
+
static {
- com.jogamp.opengl.impl.GLJNILibLoader.loadCgImpl();
+ cgProcAddressTable = new CgProcAddressTable();
+ if(null==cgProcAddressTable) {
+ throw new RuntimeException("Couldn't instantiate CgProcAddressTable");
+ }
+ DynamicLibraryBundle cgDynamicLookupHelper = new DynamicLibraryBundle(new CgDynamicLibraryBundleInfo());
+ if(null==cgDynamicLookupHelper) {
+ throw new RuntimeException("Null CgDynamicLookupHelper");
+ }
+ if(!cgDynamicLookupHelper.isToolLibLoaded()) {
+ throw new RuntimeException("Couln't load native Cg or CgGL library");
+ }
+ if(!cgDynamicLookupHelper.isGlueLibLoaded(CgDynamicLibraryBundleInfo.getCgGlueLibIndex())) {
+ throw new RuntimeException("Couln't load native GLue/JNI library");
+ }
+ cgProcAddressTable.reset(cgDynamicLookupHelper);
}
+public static CgProcAddressTable getCgProcAddressTable() { return cgProcAddressTable; }
+
/** A convenience method which reads all available data from the InputStream and then calls cgCreateProgram. */
public static CGprogram cgCreateProgramFromStream(CGcontext ctx, int program_type, java.io.InputStream stream, int profile, java.lang.String entry, java.lang.String[] args) throws java.io.IOException {
if (stream == null) {