aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/util
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-03-25 06:41:21 +0100
committerSven Gothel <[email protected]>2014-03-25 06:41:21 +0100
commit923ca6e77c03d602f9a5a71713cf5d973451687b (patch)
tree834c99f5afef9717722a38ffbd432c4643b42c22 /src/jogl/classes/com/jogamp/opengl/util
parentb71f91e67270958bdb2940615a83e4d1ccc9ca0a (diff)
ShaderCode: Allow 'srcRoot' to be optional ; RegionRendererImpl01: Allos custom shader
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
index 6a64edeb5..264b9e2a6 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
@@ -327,7 +327,7 @@ public class ShaderCode {
* @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER}
* @param count number of shaders
* @param context class used to help resolving the source and binary location
- * @param srcRoot relative <i>root</i> path for <code>srcBasenames</code>
+ * @param srcRoot relative <i>root</i> path for <code>srcBasenames</code> optional
* @param srcBasenames basenames w/o path or suffix relative to <code>srcRoot</code> for the shader's source code
* @param binRoot relative <i>root</i> path for <code>binBasenames</code>
* @param binBasename basename w/o path or suffix relative to <code>binRoot</code> for the shader's binary code
@@ -355,11 +355,17 @@ public class ShaderCode {
String srcPathString = null;
String binFileName = null;
- if(null!=srcRoot && null!=srcBasenames && ShaderUtil.isShaderCompilerAvailable(gl)) {
+ if( null!=srcBasenames && ShaderUtil.isShaderCompilerAvailable(gl) ) {
srcPath = new String[srcBasenames.length];
final String srcSuffix = getFileSuffix(false, type);
- for(int i=0; i<srcPath.length; i++) {
- srcPath[i] = srcRoot + '/' + srcBasenames[i] + "." + srcSuffix;
+ if( null != srcRoot && srcRoot.length() > 0 ) {
+ for(int i=0; i<srcPath.length; i++) {
+ srcPath[i] = srcRoot + '/' + srcBasenames[i] + "." + srcSuffix;
+ }
+ } else {
+ for(int i=0; i<srcPath.length; i++) {
+ srcPath[i] = srcBasenames[i] + "." + srcSuffix;
+ }
}
res = create(gl, type, count, context, srcPath, mutableStringBuilder);
if(null!=res) {
@@ -369,12 +375,12 @@ public class ShaderCode {
} else {
srcPath = null;
}
- if(null!=binRoot && null!=binBasename) {
+ if( null!=binBasename ) {
Set<Integer> binFmts = ShaderUtil.getShaderBinaryFormats(gl);
final String binSuffix = getFileSuffix(true, type);
for(Iterator<Integer> iter=binFmts.iterator(); iter.hasNext(); ) {
int bFmt = iter.next().intValue();
- String bFmtPath = getBinarySubPath(bFmt);
+ final String bFmtPath = getBinarySubPath(bFmt);
if(null==bFmtPath) continue;
binFileName = binRoot + '/' + bFmtPath + '/' + binBasename + "." + binSuffix;
res = create(type, count, context, bFmt, binFileName);
@@ -426,7 +432,7 @@ public class ShaderCode {
* or to determine the shader binary format (if <code>binary</code> is used).
* @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER}
* @param context class used to help resolving the source and binary location
- * @param srcRoot relative <i>root</i> path for <code>basename</code>
+ * @param srcRoot relative <i>root</i> path for <code>basename</code> optional
* @param binRoot relative <i>root</i> path for <code>basename</code>
* @param mutableStringBuilder TODO
* @param basenames basename w/o path or suffix relative to <code>srcRoot</code> and <code>binRoot</code>