diff options
author | Sven Gothel <[email protected]> | 2012-10-18 09:35:11 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-10-18 09:35:11 +0200 |
commit | 153a37378beff3f8b40fed8e55b62c2f2790eca5 (patch) | |
tree | ecb38e0b814fe563bb90e644a3d2aab8945995c4 /src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java | |
parent | 1b327874356130096546533a690deff3b7bc876c (diff) |
FixedFuncPipeline/Hook: Add glColor4ub() w/ value conversion, make glColor4f() more efficient, use pre-alloc NIO buffer
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java index 09f52e2a5..5a1678efa 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java @@ -135,16 +135,22 @@ public class FixedFuncPipeline { // // Simple Globals // - - public void glColor4fv(GL2ES2 gl, FloatBuffer data ) { + public void glColor4f(GL2ES2 gl, float red, float green, float blue, float alpha) { + colorStatic.put(0, red); + colorStatic.put(1, green); + colorStatic.put(2, blue); + colorStatic.put(3, alpha); + shaderState.useProgram(gl, true); - GLUniformData ud = shaderState.getUniform(mgl_ColorStatic); + final GLUniformData ud = shaderState.getUniform(mgl_ColorStatic); if(null!=ud) { - ud.setData(data); + // same data object .. shaderState.uniform(gl, ud); - } + } else { + throw new GLException("Failed to update: mgl_ColorStatic"); + } } - + // // Arrays / States // @@ -897,7 +903,7 @@ public class FixedFuncPipeline { } shaderState.uniform(gl, new GLUniformData(mgl_ColorEnabled, 0)); - shaderState.uniform(gl, new GLUniformData(mgl_ColorStatic, 4, one4f)); + shaderState.uniform(gl, new GLUniformData(mgl_ColorStatic, 4, colorStatic)); texID2Format.setKeyNotFoundValue(0); shaderState.uniform(gl, new GLUniformData(mgl_TexCoordEnabled, 1, textureCoordEnabled)); @@ -943,6 +949,8 @@ public class FixedFuncPipeline { protected boolean verbose = DEBUG; + private final FloatBuffer colorStatic = Buffers.copyFloatBuffer(one4f); + private int activeTextureUnit=0; private int clientActiveTextureUnit=0; private final IntIntHashMap texID2Format = new IntIntHashMap(); |