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/FixedFuncHook.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/FixedFuncHook.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java index 814d7f519..ee2a08d1f 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java @@ -44,6 +44,7 @@ import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.fixedfunc.GLPointerFunc; import com.jogamp.common.nio.Buffers; +import com.jogamp.common.util.ValueConv; import com.jogamp.opengl.util.GLArrayDataWrapper; import com.jogamp.opengl.util.GLBuffers; import com.jogamp.opengl.util.PMVMatrix; @@ -306,9 +307,15 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun // LightingIf // public void glColor4f(float red, float green, float blue, float alpha) { - fixedFunction.glColor4fv(gl, GLBuffers.newDirectFloatBuffer(new float[] { red, green, blue, alpha })); + fixedFunction.glColor4f(gl, red, green, blue, alpha); + } + + public void glColor4ub(byte red, byte green, byte blue, byte alpha) { + glColor4f(ValueConv.byte_to_float(red, false), + ValueConv.byte_to_float(green, false), + ValueConv.byte_to_float(blue, false), + ValueConv.byte_to_float(alpha, false) ); } - public void glLightfv(int light, int pname, java.nio.FloatBuffer params) { fixedFunction.glLightfv(gl, light, pname, params); } |