From 2b954ff1fe88f35b59da6c6f6b82fde70274a6ef Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Sat, 27 Mar 2010 23:24:13 +0100 Subject: refactoring: renamed com.sun.opengl -> com.jogamp.opengl. --- .../com/sun/opengl/util/glsl/ShaderCode.java | 347 --------------------- 1 file changed, 347 deletions(-) delete mode 100644 src/jogl/classes/com/sun/opengl/util/glsl/ShaderCode.java (limited to 'src/jogl/classes/com/sun/opengl/util/glsl/ShaderCode.java') diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/sun/opengl/util/glsl/ShaderCode.java deleted file mode 100644 index 606d2e1b5..000000000 --- a/src/jogl/classes/com/sun/opengl/util/glsl/ShaderCode.java +++ /dev/null @@ -1,347 +0,0 @@ - -package com.sun.opengl.util.glsl; - -import javax.media.opengl.*; -import com.sun.opengl.util.*; -import com.sun.opengl.impl.Debug; - -import java.util.*; -import java.nio.*; -import java.io.*; -import java.net.*; -import java.security.*; - -public class ShaderCode { - public static final boolean DEBUG = Debug.debug("GLSLCode"); - public static final boolean DEBUG_CODE = Debug.isPropertyDefined("jogl.debug.GLSLCode", true, AccessController.getContext()); - - public static final String SUFFIX_VERTEX_SOURCE = "vp" ; - public static final String SUFFIX_VERTEX_BINARY = "bvp" ; - public static final String SUFFIX_FRAGMENT_SOURCE = "fp" ; - public static final String SUFFIX_FRAGMENT_BINARY = "bfp" ; - - public static final String SUB_PATH_NVIDIA = "nvidia" ; - - public ShaderCode(int type, int number, String[][] source) { - switch (type) { - case GL2ES2.GL_VERTEX_SHADER: - case GL2ES2.GL_FRAGMENT_SHADER: - break; - default: - throw new GLException("Unknown shader type: "+type); - } - shaderSource = source; - shaderBinaryFormat = -1; - shaderBinary = null; - shaderType = type; - shader = BufferUtil.newIntBuffer(number); - id = getNextID(); - - if(DEBUG_CODE) { - System.out.println("Created: "+toString()); - dumpShaderSource(System.out); - } - } - - public ShaderCode(int type, int number, int binFormat, Buffer binary) { - switch (type) { - case GL2ES2.GL_VERTEX_SHADER: - case GL2ES2.GL_FRAGMENT_SHADER: - break; - default: - throw new GLException("Unknown shader type: "+type); - } - shaderSource = null; - shaderBinaryFormat = binFormat; - shaderBinary = binary; - shaderType = type; - shader = BufferUtil.newIntBuffer(number); - id = getNextID(); - } - - public static ShaderCode create(GL2ES2 gl, int type, int number, Class context, String[] sourceFiles) { - if(!ShaderUtil.isShaderCompilerAvailable(gl)) return null; - - String[][] shaderSources = null; - if(null!=sourceFiles) { - shaderSources = new String[sourceFiles.length][1]; - for(int i=0; null!=shaderSources && i"); - return; - } - int sourceNum = (null!=shaderSource)?shaderSource.length:0; - int shaderNum = (null!=shader)?shader.capacity():0; - for(int i=0; i=sourceNum) { - out.println(""); - } else { - String[] src = shaderSource[i]; - for(int j=0; j= 0) { - String tmpPath = className.substring(0, lastSlash + 1) + path; - url = Locator.getResource(tmpPath, contextCL); - if (url != null) { - path = tmpPath; - } - } - } - if (url == null) { - return null; - } - StringBuffer result = new StringBuffer(); - readShaderSource(contextCL, path, url, result); - return result.toString(); - } - - public static ByteBuffer readShaderBinary(Class context, String path) { - try { - URL url = Locator.getResource(context, path); - if (url == null) { - return null; - } - return StreamUtil.readAll2Buffer(new BufferedInputStream(url.openStream())); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - protected String[][] shaderSource = null; - protected Buffer shaderBinary = null; - protected int shaderBinaryFormat = -1; - protected IntBuffer shader = null; - protected int shaderType = -1; - protected Integer id = null; - - protected boolean valid=false; - - private static synchronized Integer getNextID() { - return new Integer(nextID++); - } - protected static int nextID = 1; -} - -- cgit v1.2.3