From e5d63fe78dfe6760de7997e5303aada7ab8b570e Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Mon, 29 Mar 2010 14:07:26 +0200 Subject: com.jogamp.opengl.util.BufferUtil extends com.jogamp.gluegen.runtime.Buffers. removed all redundant methods from BufferUtil. --- .../com/jogamp/opengl/util/glsl/ShaderCode.java | 5 +++-- .../util/glsl/fixedfunc/impl/FixedFuncHook.java | 12 ++++++------ .../glsl/fixedfunc/impl/FixedFuncPipeline.java | 22 +++++++++++----------- 3 files changed, 20 insertions(+), 19 deletions(-) (limited to 'src/jogl/classes/com/jogamp/opengl/util/glsl') diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java index 01b94d0d9..94b329cd5 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java @@ -1,6 +1,7 @@ package com.jogamp.opengl.util.glsl; +import com.jogamp.gluegen.runtime.Buffers; import javax.media.opengl.*; import com.jogamp.opengl.util.*; import com.jogamp.opengl.impl.Debug; @@ -34,7 +35,7 @@ public class ShaderCode { shaderBinaryFormat = -1; shaderBinary = null; shaderType = type; - shader = BufferUtil.newIntBuffer(number); + shader = Buffers.newDirectIntBuffer(number); id = getNextID(); if(DEBUG_CODE) { @@ -55,7 +56,7 @@ public class ShaderCode { shaderBinaryFormat = binFormat; shaderBinary = binary; shaderType = type; - shader = BufferUtil.newIntBuffer(number); + shader = Buffers.newDirectIntBuffer(number); id = getNextID(); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java index 6e5bd2eb2..b69cc2b72 100755 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java @@ -128,7 +128,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun pmvMatrix.glLoadMatrixf(m); } public void glLoadMatrixf(float[] m, int m_offset) { - glLoadMatrixf(BufferUtil.newFloatBuffer(m, m_offset)); + glLoadMatrixf(BufferUtil.newDirectFloatBuffer(m, m_offset)); } public void glPopMatrix() { pmvMatrix.glPopMatrix(); @@ -143,7 +143,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun pmvMatrix.glMultMatrixf(m); } public void glMultMatrixf(float[] m, int m_offset) { - glMultMatrixf(BufferUtil.newFloatBuffer(m, m_offset)); + glMultMatrixf(BufferUtil.newDirectFloatBuffer(m, m_offset)); } public void glTranslatef(float x, float y, float z) { pmvMatrix.glTranslatef(x, y, z); @@ -165,23 +165,23 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun // LightingIf // public void glColor4f(float red, float green, float blue, float alpha) { - fixedFunction.glColor4fv(gl, BufferUtil.newFloatBuffer(new float[] { red, green, blue, alpha })); + fixedFunction.glColor4fv(gl, BufferUtil.newDirectFloatBuffer(new float[] { red, green, blue, alpha })); } public void glLightfv(int light, int pname, java.nio.FloatBuffer params) { fixedFunction.glLightfv(gl, light, pname, params); } public void glLightfv(int light, int pname, float[] params, int params_offset) { - glLightfv(light, pname, BufferUtil.newFloatBuffer(params, params_offset)); + glLightfv(light, pname, BufferUtil.newDirectFloatBuffer(params, params_offset)); } public void glMaterialfv(int face, int pname, java.nio.FloatBuffer params) { fixedFunction.glMaterialfv(gl, face, pname, params); } public void glMaterialfv(int face, int pname, float[] params, int params_offset) { - glMaterialfv(face, pname, BufferUtil.newFloatBuffer(params, params_offset)); + glMaterialfv(face, pname, BufferUtil.newDirectFloatBuffer(params, params_offset)); } public void glMaterialf(int face, int pname, float param) { - glMaterialfv(face, pname, BufferUtil.newFloatBuffer(new float[] { param })); + glMaterialfv(face, pname, BufferUtil.newDirectFloatBuffer(new float[] { param })); } public void glShadeModel(int mode) { fixedFunction.glShadeModel(gl, mode); diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncPipeline.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncPipeline.java index 1a60ab21e..9ead6c4eb 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncPipeline.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncPipeline.java @@ -1,11 +1,11 @@ package com.jogamp.opengl.util.glsl.fixedfunc.impl; +import com.jogamp.gluegen.runtime.Buffers; import javax.media.opengl.*; import javax.media.opengl.fixedfunc.*; import com.jogamp.opengl.util.*; import com.jogamp.opengl.util.glsl.*; -import com.jogamp.opengl.util.glsl.fixedfunc.*; import java.nio.*; public class FixedFuncPipeline { @@ -490,14 +490,14 @@ public class FixedFuncPipeline { protected boolean verbose=false; protected boolean textureEnabled=false; - protected IntBuffer textureCoordsEnabled = BufferUtil.newIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }); + protected IntBuffer textureCoordsEnabled = Buffers.newDirectIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }); protected boolean textureCoordsEnabledDirty = false; protected int activeTextureUnit=0; protected int cullFace=-2; // <=0 disabled, 1: front, 2: back (default, but disabled), 3: front & back protected boolean lightingEnabled=false; - protected IntBuffer lightsEnabled = BufferUtil.newIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }); + protected IntBuffer lightsEnabled = Buffers.newDirectIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }); protected boolean lightsEnabledDirty = false; protected PMVMatrix pmvMatrix; @@ -525,23 +525,23 @@ public class FixedFuncPipeline { protected static final String mgl_CullFace = "mgl_CullFace"; // 1i - protected static final FloatBuffer zero4f = BufferUtil.newFloatBuffer(new float[] { 0.0f, 0.0f, 0.0f, 0.0f }); + protected static final FloatBuffer zero4f = Buffers.newDirectFloatBuffer(new float[] { 0.0f, 0.0f, 0.0f, 0.0f }); - public static final FloatBuffer defAmbient = BufferUtil.newFloatBuffer(new float[] { 0f, 0f, 0f, 1f }); + public static final FloatBuffer defAmbient = Buffers.newDirectFloatBuffer(new float[] { 0f, 0f, 0f, 1f }); public static final FloatBuffer defDiffuse = zero4f; public static final FloatBuffer defSpecular= zero4f; - public static final FloatBuffer defPosition= BufferUtil.newFloatBuffer(new float[] { 0f, 0f, 1f, 0f }); - public static final FloatBuffer defSpotDir = BufferUtil.newFloatBuffer(new float[] { 0f, 0f, -1f }); + public static final FloatBuffer defPosition= Buffers.newDirectFloatBuffer(new float[] { 0f, 0f, 1f, 0f }); + public static final FloatBuffer defSpotDir = Buffers.newDirectFloatBuffer(new float[] { 0f, 0f, -1f }); public static final float defSpotExponent = 0f; public static final float defSpotCutoff = 180f; public static final float defConstantAtten = 1f; public static final float defLinearAtten = 0f; public static final float defQuadraticAtten= 0f; - public static final FloatBuffer defMatAmbient = BufferUtil.newFloatBuffer(new float[] { 0.2f, 0.2f, 0.2f, 1.0f }); - public static final FloatBuffer defMatDiffuse = BufferUtil.newFloatBuffer(new float[] { 0.8f, 0.8f, 0.8f, 1.0f }); - public static final FloatBuffer defMatSpecular= BufferUtil.newFloatBuffer(new float[] { 0f, 0f, 0f, 1f}); - public static final FloatBuffer defMatEmission= BufferUtil.newFloatBuffer(new float[] { 0f, 0f, 0f, 1f}); + public static final FloatBuffer defMatAmbient = Buffers.newDirectFloatBuffer(new float[] { 0.2f, 0.2f, 0.2f, 1.0f }); + public static final FloatBuffer defMatDiffuse = Buffers.newDirectFloatBuffer(new float[] { 0.8f, 0.8f, 0.8f, 1.0f }); + public static final FloatBuffer defMatSpecular= Buffers.newDirectFloatBuffer(new float[] { 0f, 0f, 0f, 1f}); + public static final FloatBuffer defMatEmission= Buffers.newDirectFloatBuffer(new float[] { 0f, 0f, 0f, 1f}); public static final float defMatShininess = 0f; protected static final String vertexColorFileDef = "FixedFuncColor"; -- cgit v1.2.3