JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
CgDynamicLibraryBundleInfo.java
Go to the documentation of this file.
1/**
2 * Copyright 2010 JogAmp Community. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are
5 * permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * The views and conclusions contained in the software and documentation are those of the
25 * authors and should not be interpreted as representing official policies, either expressed
26 * or implied, of JogAmp Community.
27 */
28
29package com.jogamp.opengl.cg;
30
31import com.jogamp.common.jvm.JNILibLoaderBase;
32import com.jogamp.common.os.DynamicLibraryBundle;
33import com.jogamp.common.os.DynamicLibraryBundleInfo;
34import com.jogamp.common.os.Platform;
35import com.jogamp.common.util.RunnableExecutor;
36import com.jogamp.common.util.SecurityUtil;
37import com.jogamp.common.util.cache.TempJarCache;
38
39import java.security.PrivilegedAction;
40import java.util.*;
41
42public final class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
43 private static final List<String> glueLibNames;
44 static {
45 SecurityUtil.doPrivileged(new PrivilegedAction<Object>() {
46 @Override
47 public Object run() {
48 Platform.initSingleton();
49
50 if( TempJarCache.isInitialized(true) ) {
51 // only: jogl-cg.jar -> jogl-cg-natives-<os.and.arch>.jar [atomic JAR files only]
52 JNILibLoaderBase.addNativeJarLibs(new Class<?>[] { jogamp.opengl.cg.CgPackagePlaceholder.class }, null);
53 }
54 return null;
55 }
56 });
57
58 glueLibNames = new ArrayList<String>();
59 // glueLibNames.addAll(getGlueLibNamesPreload());
60 glueLibNames.add("jogl_cg");
61 }
62
63 public static final int getCgGlueLibIndex() {
64 return glueLibNames.size()-1;
65 }
66
68 super();
69 }
70
71 /** Make Cg symbols available to CgGL */
72 @Override
73 public final boolean shallLinkGlobal() { return true; }
74
75 /**
76 * {@inheritDoc}
77 * <p>
78 * Returns <code>false</code>.
79 * </p>
80 */
81 @Override
82 public final boolean shallLookupGlobal() { return false; }
83
84 /** Tool has none **/
85 @Override
86 public final List<String> getToolGetProcAddressFuncNameList() {
87 return null;
88 }
89
90 /** Tool has none **/
91 @Override
92 public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) {
93 return 0;
94 }
95
96 @Override
97 public final boolean useToolGetProcAdressFirst(final String funcName) {
98 return false;
99 }
100
101 @Override
102 public final boolean searchToolLibInSystemPath() {
103 return true;
104 }
105
106 @Override
107 public final boolean searchToolLibSystemPathFirst() {
108 return true;
109 }
110
111 @Override
112 public final List<List<String>> getToolLibNames() {
113 final List<List<String>> libsList = new ArrayList<List<String>>();
114 final List<String> libsCg = new ArrayList<String>();
115 libsCg.add("Cg");
116 libsList.add(libsCg);
117
118 final List<String> libsCgGL = new ArrayList<String>();
119 libsCgGL.add("CgGL");
120 libsList.add(libsCgGL);
121
122 return libsList;
123 }
124 @Override
125 public List<String> getSymbolForToolLibPath() { return Arrays.asList("cgCreateContext", "cgGLLoadProgram"); }
126
127 @Override
128 public final List<String> getGlueLibNames() {
129 return glueLibNames;
130 }
131
132 @Override
133 public final RunnableExecutor getLibLoaderExecutor() {
134 return DynamicLibraryBundle.getDefaultRunnableExecutor();
135 }
136}
137
138
final boolean shallLinkGlobal()
Make Cg symbols available to CgGL.
final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName)
Tool has none.
final boolean useToolGetProcAdressFirst(final String funcName)
final List< String > getToolGetProcAddressFuncNameList()
Tool has none.