summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/util
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-03-30 17:44:03 +0200
committerSven Gothel <[email protected]>2011-03-30 17:44:03 +0200
commit49542d1c2963c72598c0bc23a56b2ae54c90d21a (patch)
treed4c944a9666125ed491fd73a753b76c1f77945ec /src/jogl/classes/com/jogamp/opengl/util
parent4c37cbf64440ee1e3986afff94b74b513bed2bab (diff)
ShaderCode: Remove redundant code (Use proper Locator variant)
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/Locator.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java19
2 files changed, 5 insertions, 16 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Locator.java b/src/jogl/classes/com/jogamp/opengl/util/Locator.java
index c524c0888..8dbd7cd93 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/Locator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Locator.java
@@ -33,8 +33,6 @@
package com.jogamp.opengl.util;
-import java.util.*;
-import java.nio.*;
import java.io.*;
import java.net.*;
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 5dd1b5a3a..1f59318f2 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
@@ -321,22 +321,13 @@ public class ShaderCode {
public static String readShaderSource(Class context, String path) {
ClassLoader contextCL = (null!=context)?context.getClassLoader():null;
- URL url = Locator.getResource(path, contextCL);
- if (url == null && null!=context) {
- // Try again by scoping the path within the class's package
- String className = context.getName().replace('.', '/');
- int lastSlash = className.lastIndexOf('/');
- if (lastSlash >= 0) {
- String tmpPath = className.substring(0, lastSlash + 1) + path;
- url = Locator.getResource(tmpPath, contextCL);
- if (url != null) {
- path = tmpPath;
- }
- }
- }
+ URL url = Locator.getResource(context, path);
if (url == null) {
return null;
- }
+ }
+ File pf = new File(url.getPath());
+ path = pf.getParent() + "/" ;
+
StringBuffer result = new StringBuffer();
readShaderSource(contextCL, path, url, result);
return result.toString();