From 9517539e3b43d21017465180376329439bc25f12 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 12 Aug 2008 08:39:08 +0000 Subject: Working: APX 2500 ES 2.0 + FixedFunction GLSL ES 1.0 +++ javax.media.opengl.glsl - Shader and program state management - Loading and merging shader source code - Loading binaries incl. auto selection of the binary file in respect to the supported binary format. I.e. in case of GLES2.GL_NVIDIA_PLATFORM_BINARY_NV: source: com/sun/opengl/impl/glsl/fixed/shader/ashader.fp binary: com/sun/opengl/impl/glsl/fixed/shader/bin/nvidia/ashader.bfp ShaderCode sc = ShaderCode.create( gl, gl.GL_VERTEX_SHADER, 1, FixedFuncPipeline.class, "shader", "shader/bin", "ashader"); (Derivation of com.sun.javafx.graphics.gl2es2.ShaderUtil) javax.media.opengl.sdk.glsl CompileShaderNVidia implements abstract CompileShader Toolkit to convert JOGL shader source to binaries, according to the location rule as described in ShaderCode. Example: Converts all fixed function shader to binaries. jogl/src/classes/com/sun/opengl/impl/glsl/fixed/shader/scripts/nvidia-apx/glslc-ff.bat (Generalization of com.sun.javafx.graphics.gl2es2.PrecompileNVShader) +++ Fixed function now resides in 'jogl.fixed.jar' - contains shader source and binaries - contains the implementation GL2ES2: - removed glShaderBinaryOrSource() - use glCreateLoadShader() for binary and glCreateCompileShader() for source - using addition glGetError() check for shader upload/compilation - Skipping 'glValidateProgram' in case of ES2 and no compiler, since it fails on APX2500 .. - added: (caching the results) "public Set glGetShaderBinaryFormats()" "public boolean glShaderCompilerAvailable()" - shader-name and binary-data buffer: use 'remaining()' instead of 'limit()' BufferUtil: - adding variant: Buffer newBuffer([] values, int offset, int len) +++ Working on all profiles ES1 + ES2 (CVM) with lighting: demo.es1.cube.Cube demo.es1.cube.CubeImmModeSink demo.es1.cubefbo.Main javabullet.demos.genericjoint.GenericJointDemo git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1749 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../javax/media/opengl/util/BufferUtil.java.javase | 28 +++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'src/classes/javax/media/opengl/util/BufferUtil.java.javase') diff --git a/src/classes/javax/media/opengl/util/BufferUtil.java.javase b/src/classes/javax/media/opengl/util/BufferUtil.java.javase index 944e4d8d4..6ea6fe2c7 100755 --- a/src/classes/javax/media/opengl/util/BufferUtil.java.javase +++ b/src/classes/javax/media/opengl/util/BufferUtil.java.javase @@ -69,14 +69,17 @@ public class BufferUtil { return bb; } - public static ByteBuffer newByteBuffer(byte[] values, int offset) { - int len = values.length-offset; + public static ByteBuffer newByteBuffer(byte[] values, int offset, int len) { ByteBuffer bb = newByteBuffer(len); bb.put(values, offset, len); bb.rewind(); return bb; } + public static ByteBuffer newByteBuffer(byte[] values, int offset) { + return newByteBuffer(values, offset, values.length-offset); + } + public static ByteBuffer newByteBuffer(byte[] values) { return newByteBuffer(values, 0); } @@ -111,14 +114,17 @@ public class BufferUtil { return bb.asFloatBuffer(); } - public static FloatBuffer newFloatBuffer(float[] values, int offset) { - int len = values.length-offset; + public static FloatBuffer newFloatBuffer(float[] values, int offset, int len) { FloatBuffer bb = newFloatBuffer(len); bb.put(values, offset, len); bb.rewind(); return bb; } + public static FloatBuffer newFloatBuffer(float[] values, int offset) { + return newFloatBuffer(values, 0, values.length-offset); + } + public static FloatBuffer newFloatBuffer(float[] values) { return newFloatBuffer(values, 0); } @@ -132,14 +138,17 @@ public class BufferUtil { return bb.asIntBuffer(); } - public static IntBuffer newIntBuffer(int[] values, int offset) { - int len = values.length-offset; + public static IntBuffer newIntBuffer(int[] values, int offset, int len) { IntBuffer bb = newIntBuffer(len); bb.put(values, offset, len); bb.rewind(); return bb; } + public static IntBuffer newIntBuffer(int[] values, int offset) { + return newIntBuffer(values, 0, values.length-offset); + } + public static IntBuffer newIntBuffer(int[] values) { return newIntBuffer(values, 0); } @@ -160,14 +169,17 @@ public class BufferUtil { return bb.asShortBuffer(); } - public static ShortBuffer newShortBuffer(short[] values, int offset) { - int len = values.length-offset; + public static ShortBuffer newShortBuffer(short[] values, int offset, int len) { ShortBuffer bb = newShortBuffer(len); bb.put(values, offset, len); bb.rewind(); return bb; } + public static ShortBuffer newShortBuffer(short[] values, int offset) { + return newShortBuffer(values, 0, values.length-offset); + } + public static ShortBuffer newShortBuffer(short[] values) { return newShortBuffer(values, 0); } -- cgit v1.2.3