From 62e5686fb583ad991d5811baf242d40d21952e27 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 16 Apr 2012 01:38:49 +0200 Subject: API Change ShaderCode/ShaderUtil: Enable optional mutable shader source / generalize shader source storage type to CharSequence[] Benefits: - Allows code injection and general shader source editing (before compilation) - Uses mutable StringBuilder only if editing is intended, hence reduces memory footprint and String conversion at compilation in such case. - ShaderCode.create(..) factory methods add nw attribute 'mutableStringBuilder' if true method returns a mutable StringBuilder instance which can be edited later on at the costs of a String conversion when passing to 'glShaderSource(int, int, String[], IntBuffer)'. If false method returns an immutable String instance, which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)} at no additional costs. - New 'edit' methods in ShaderCode: ' - int insertShaderSource(int shaderIdx, String tag, int fromIndex, CharSequence data); - int insertShaderSource(int shaderIdx, int position, CharSequence data); --- .../classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java | 8 ++++---- .../classes/jogamp/graph/curve/opengl/TextRendererImpl01.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/jogl/classes/jogamp/graph') diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java index 32a2f0b73..117faafb8 100755 --- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java @@ -56,10 +56,10 @@ public class RegionRendererImpl01 extends RegionRenderer { protected boolean initShaderProgram(GL2ES2 gl) { final ShaderState st = rs.getShaderState(); - ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, RegionRendererImpl01.class, - "shader", "shader/bin", getVertexShaderName(gl)); - ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, 1, RegionRendererImpl01.class, - "shader", "shader/bin", getFragmentShaderName(gl)); + ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RegionRendererImpl01.class, "shader", + "shader/bin", getVertexShaderName(gl), false); + ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RegionRendererImpl01.class, "shader", + "shader/bin", getFragmentShaderName(gl), false); ShaderProgram sp = new ShaderProgram(); sp.add(rsVp); diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java index 05d0707e2..158f0240a 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java @@ -49,10 +49,10 @@ public class TextRendererImpl01 extends TextRenderer { protected boolean initShaderProgram(GL2ES2 gl){ final ShaderState st = rs.getShaderState(); - ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, TextRendererImpl01.class, - "shader", "shader/bin", getVertexShaderName(gl)); - ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, 1, TextRendererImpl01.class, - "shader", "shader/bin", getFragmentShaderName(gl)); + ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, TextRendererImpl01.class, "shader", + "shader/bin", getVertexShaderName(gl), false); + ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, TextRendererImpl01.class, "shader", + "shader/bin", getFragmentShaderName(gl), false); ShaderProgram sp = new ShaderProgram(); sp.add(rsVp); -- cgit v1.2.3