From 273fb3383a04408725ee2bda632af0edf6e8421f Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Mon, 29 Mar 2010 15:35:45 +0200 Subject: renamed BufferUtil to GLBuffers. --- .../classes/com/jogamp/opengl/util/BufferUtil.java | 156 --------------------- .../com/jogamp/opengl/util/GLArrayDataWrapper.java | 8 +- .../classes/com/jogamp/opengl/util/GLBuffers.java | 137 ++++++++++++++++++ .../com/jogamp/opengl/util/ImmModeSink.java | 156 ++++++++++----------- .../classes/com/jogamp/opengl/util/StreamUtil.java | 2 +- .../util/glsl/fixedfunc/impl/FixedFuncHook.java | 12 +- .../jogamp/opengl/util/texture/TextureData.java | 2 +- .../util/texture/spi/DDSImage.java.javame_cdc_fp | 2 +- .../opengl/util/texture/spi/DDSImage.java.javase | 2 +- 9 files changed, 229 insertions(+), 248 deletions(-) delete mode 100755 src/jogl/classes/com/jogamp/opengl/util/BufferUtil.java create mode 100755 src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java (limited to 'src/jogl/classes/com/jogamp/opengl') diff --git a/src/jogl/classes/com/jogamp/opengl/util/BufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/BufferUtil.java deleted file mode 100755 index 41baf03d7..000000000 --- a/src/jogl/classes/com/jogamp/opengl/util/BufferUtil.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ -package com.jogamp.opengl.util; - -import com.jogamp.gluegen.runtime.Buffers; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES2; - -import java.nio.*; - -/** - * Utility routines for dealing with direct buffers. - * @author Kenneth Russel - * @author Michael Bien - */ -public class BufferUtil extends Buffers { - - public static final int sizeOfGLType(int glType) { - switch (glType) { - case GL.GL_UNSIGNED_BYTE: - return SIZEOF_BYTE; - case GL.GL_BYTE: - return SIZEOF_BYTE; - case GL.GL_UNSIGNED_SHORT: - return SIZEOF_SHORT; - case GL.GL_SHORT: - return SIZEOF_SHORT; - case GL.GL_FLOAT: - return SIZEOF_FLOAT; - case GL.GL_FIXED: - return SIZEOF_INT; - case GL2ES2.GL_INT: - return SIZEOF_INT; - case GL2ES2.GL_UNSIGNED_INT: - return SIZEOF_INT; - case GL2.GL_DOUBLE: - return SIZEOF_DOUBLE; - } - return -1; - } - - public static final int sizeOfBufferElem(Buffer buffer) { - if (buffer == null) { - return 0; - } - if (buffer instanceof ByteBuffer) { - return BufferUtil.SIZEOF_BYTE; - } else if (buffer instanceof IntBuffer) { - return BufferUtil.SIZEOF_INT; - } else if (buffer instanceof ShortBuffer) { - return BufferUtil.SIZEOF_SHORT; - } else if (buffer instanceof FloatBuffer) { - return BufferUtil.SIZEOF_FLOAT; - } else if (buffer instanceof DoubleBuffer) { - return BufferUtil.SIZEOF_DOUBLE; - } - throw new RuntimeException("Unexpected buffer type " - + buffer.getClass().getName()); - } - - public static final Buffer newDirectGLBuffer(int glType, int numElements) { - switch (glType) { - case GL.GL_UNSIGNED_BYTE: - case GL.GL_BYTE: - return newDirectByteBuffer(numElements); - case GL.GL_UNSIGNED_SHORT: - case GL.GL_SHORT: - return newDirectShortBuffer(numElements); - case GL.GL_FLOAT: - return newDirectFloatBuffer(numElements); - case GL.GL_FIXED: - case GL2ES2.GL_INT: - case GL2ES2.GL_UNSIGNED_INT: - return newDirectIntBuffer(numElements); - case GL2.GL_DOUBLE: - return newDirectDoubleBuffer(numElements); - } - return null; - } - - public static final Buffer sliceGLBuffer(ByteBuffer parent, int bytePos, int byteLen, int glType) { - if (parent == null || byteLen == 0) { - return null; - } - parent.position(bytePos); - parent.limit(bytePos + byteLen); - - switch (glType) { - case GL.GL_UNSIGNED_BYTE: - case GL.GL_BYTE: - return parent.slice(); - case GL.GL_UNSIGNED_SHORT: - case GL.GL_SHORT: - return parent.asShortBuffer(); - case GL.GL_FLOAT: - return parent.asFloatBuffer(); - case GL.GL_FIXED: - case GL2ES2.GL_INT: - case GL2ES2.GL_UNSIGNED_INT: - return parent.asIntBuffer(); - case GL2.GL_DOUBLE: - return parent.asDoubleBuffer(); - } - return null; - } - - //---------------------------------------------------------------------- - // Conversion routines - // - public final static float[] getFloatArray(double[] source) { - int i = source.length; - float[] dest = new float[i--]; - while (i >= 0) { - dest[i] = (float) source[i]; - i--; - } - return dest; - } -} diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java index aa3059800..2ab77fa1b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java @@ -65,16 +65,16 @@ public class GLArrayDataWrapper implements GLArrayData { public final int getComponentSize() { if(clazz==ByteBuffer.class) { - return BufferUtil.SIZEOF_BYTE; + return GLBuffers.SIZEOF_BYTE; } if(clazz==ShortBuffer.class) { - return BufferUtil.SIZEOF_SHORT; + return GLBuffers.SIZEOF_SHORT; } if(clazz==IntBuffer.class) { - return BufferUtil.SIZEOF_INT; + return GLBuffers.SIZEOF_INT; } if(clazz==FloatBuffer.class) { - return BufferUtil.SIZEOF_FLOAT; + return GLBuffers.SIZEOF_FLOAT; } throw new GLException("Given Buffer Class not supported: "+clazz+":\n\t"+this); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java new file mode 100755 index 000000000..b49bb3364 --- /dev/null +++ b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ +package com.jogamp.opengl.util; + +import com.jogamp.gluegen.runtime.Buffers; +import javax.media.opengl.GL; +import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES2; + +import java.nio.*; + +/** + * Utility routines for dealing with direct buffers. + * @author Kenneth Russel + * @author Michael Bien + */ +public class GLBuffers extends Buffers { + + public static final int sizeOfGLType(int glType) { + switch (glType) { + case GL.GL_UNSIGNED_BYTE: + return SIZEOF_BYTE; + case GL.GL_BYTE: + return SIZEOF_BYTE; + case GL.GL_UNSIGNED_SHORT: + return SIZEOF_SHORT; + case GL.GL_SHORT: + return SIZEOF_SHORT; + case GL.GL_FLOAT: + return SIZEOF_FLOAT; + case GL.GL_FIXED: + return SIZEOF_INT; + case GL2ES2.GL_INT: + return SIZEOF_INT; + case GL2ES2.GL_UNSIGNED_INT: + return SIZEOF_INT; + case GL2.GL_DOUBLE: + return SIZEOF_DOUBLE; + } + return -1; + } + + public static final Buffer newDirectGLBuffer(int glType, int numElements) { + switch (glType) { + case GL.GL_UNSIGNED_BYTE: + case GL.GL_BYTE: + return newDirectByteBuffer(numElements); + case GL.GL_UNSIGNED_SHORT: + case GL.GL_SHORT: + return newDirectShortBuffer(numElements); + case GL.GL_FLOAT: + return newDirectFloatBuffer(numElements); + case GL.GL_FIXED: + case GL2ES2.GL_INT: + case GL2ES2.GL_UNSIGNED_INT: + return newDirectIntBuffer(numElements); + case GL2.GL_DOUBLE: + return newDirectDoubleBuffer(numElements); + } + return null; + } + + public static final Buffer sliceGLBuffer(ByteBuffer parent, int bytePos, int byteLen, int glType) { + if (parent == null || byteLen == 0) { + return null; + } + parent.position(bytePos); + parent.limit(bytePos + byteLen); + + switch (glType) { + case GL.GL_UNSIGNED_BYTE: + case GL.GL_BYTE: + return parent.slice(); + case GL.GL_UNSIGNED_SHORT: + case GL.GL_SHORT: + return parent.asShortBuffer(); + case GL.GL_FLOAT: + return parent.asFloatBuffer(); + case GL.GL_FIXED: + case GL2ES2.GL_INT: + case GL2ES2.GL_UNSIGNED_INT: + return parent.asIntBuffer(); + case GL2.GL_DOUBLE: + return parent.asDoubleBuffer(); + } + return null; + } + + //---------------------------------------------------------------------- + // Conversion routines + // + public final static float[] getFloatArray(double[] source) { + int i = source.length; + float[] dest = new float[i--]; + while (i >= 0) { + dest[i] = (float) source[i]; + i--; + } + return dest; + } +} diff --git a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java index 22a2d8a9f..126a303ab 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java +++ b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java @@ -361,79 +361,79 @@ public class ImmModeSink { public void glVertexv(Buffer v) { checkSeal(false); - BufferUtil.put(vertexArray, v); + GLBuffers.put(vertexArray, v); } public void glNormalv(Buffer v) { checkSeal(false); - BufferUtil.put(normalArray, v); + GLBuffers.put(normalArray, v); } public void glColorv(Buffer v) { checkSeal(false); - BufferUtil.put(colorArray, v); + GLBuffers.put(colorArray, v); } public void glTexCoordv(Buffer v) { checkSeal(false); - BufferUtil.put(textCoordArray, v); + GLBuffers.put(textCoordArray, v); } public void glVertex2b(byte x, byte y) { checkSeal(false); growBufferIfNecessary(VERTEX, 2); if(vComps>0) - BufferUtil.putb(vertexArray, x); + GLBuffers.putb(vertexArray, x); if(vComps>1) - BufferUtil.putb(vertexArray, y); + GLBuffers.putb(vertexArray, y); padding(VERTEX, vComps-2); } public void glVertex3b(byte x, byte y, byte z) { checkSeal(false); growBufferIfNecessary(VERTEX, 3); if(vComps>0) - BufferUtil.putb(vertexArray, x); + GLBuffers.putb(vertexArray, x); if(vComps>1) - BufferUtil.putb(vertexArray, y); + GLBuffers.putb(vertexArray, y); if(vComps>2) - BufferUtil.putb(vertexArray, z); + GLBuffers.putb(vertexArray, z); padding(VERTEX, vComps-3); } public void glVertex2s(short x, short y) { checkSeal(false); growBufferIfNecessary(VERTEX, 2); if(vComps>0) - BufferUtil.puts(vertexArray, x); + GLBuffers.puts(vertexArray, x); if(vComps>1) - BufferUtil.puts(vertexArray, y); + GLBuffers.puts(vertexArray, y); padding(VERTEX, vComps-2); } public void glVertex3s(short x, short y, short z) { checkSeal(false); growBufferIfNecessary(VERTEX, 3); if(vComps>0) - BufferUtil.puts(vertexArray, x); + GLBuffers.puts(vertexArray, x); if(vComps>1) - BufferUtil.puts(vertexArray, y); + GLBuffers.puts(vertexArray, y); if(vComps>2) - BufferUtil.puts(vertexArray, z); + GLBuffers.puts(vertexArray, z); padding(VERTEX, vComps-3); } public void glVertex2f(float x, float y) { checkSeal(false); growBufferIfNecessary(VERTEX, 2); if(vComps>0) - BufferUtil.putf(vertexArray, x); + GLBuffers.putf(vertexArray, x); if(vComps>1) - BufferUtil.putf(vertexArray, y); + GLBuffers.putf(vertexArray, y); padding(VERTEX, vComps-2); } public void glVertex3f(float x, float y, float z) { checkSeal(false); growBufferIfNecessary(VERTEX, 3); if(vComps>0) - BufferUtil.putf(vertexArray, x); + GLBuffers.putf(vertexArray, x); if(vComps>1) - BufferUtil.putf(vertexArray, y); + GLBuffers.putf(vertexArray, y); if(vComps>2) - BufferUtil.putf(vertexArray, z); + GLBuffers.putf(vertexArray, z); padding(VERTEX, vComps-3); } @@ -441,33 +441,33 @@ public class ImmModeSink { checkSeal(false); growBufferIfNecessary(NORMAL, 3); if(nComps>0) - BufferUtil.putb(normalArray, x); + GLBuffers.putb(normalArray, x); if(nComps>1) - BufferUtil.putb(normalArray, y); + GLBuffers.putb(normalArray, y); if(nComps>2) - BufferUtil.putb(normalArray, z); + GLBuffers.putb(normalArray, z); padding(NORMAL, nComps-3); } public void glNormal3s(short x, short y, short z) { checkSeal(false); growBufferIfNecessary(NORMAL, 3); if(nComps>0) - BufferUtil.puts(normalArray, x); + GLBuffers.puts(normalArray, x); if(nComps>1) - BufferUtil.puts(normalArray, y); + GLBuffers.puts(normalArray, y); if(nComps>2) - BufferUtil.puts(normalArray, z); + GLBuffers.puts(normalArray, z); padding(NORMAL, nComps-3); } public void glNormal3f(float x, float y, float z) { checkSeal(false); growBufferIfNecessary(NORMAL, 3); if(nComps>0) - BufferUtil.putf(normalArray, x); + GLBuffers.putf(normalArray, x); if(nComps>1) - BufferUtil.putf(normalArray, y); + GLBuffers.putf(normalArray, y); if(nComps>2) - BufferUtil.putf(normalArray, z); + GLBuffers.putf(normalArray, z); padding(NORMAL, nComps-3); } @@ -475,72 +475,72 @@ public class ImmModeSink { checkSeal(false); growBufferIfNecessary(COLOR, 3); if(cComps>0) - BufferUtil.putb(colorArray, r); + GLBuffers.putb(colorArray, r); if(cComps>1) - BufferUtil.putb(colorArray, g); + GLBuffers.putb(colorArray, g); if(cComps>2) - BufferUtil.putb(colorArray, b); + GLBuffers.putb(colorArray, b); padding(COLOR, cComps-3); } public void glColor4b(byte r, byte g, byte b, byte a) { checkSeal(false); growBufferIfNecessary(COLOR, 4); if(cComps>0) - BufferUtil.putb(colorArray, r); + GLBuffers.putb(colorArray, r); if(cComps>1) - BufferUtil.putb(colorArray, g); + GLBuffers.putb(colorArray, g); if(cComps>2) - BufferUtil.putb(colorArray, b); + GLBuffers.putb(colorArray, b); if(cComps>3) - BufferUtil.putb(colorArray, a); + GLBuffers.putb(colorArray, a); padding(COLOR, cComps-4); } public void glColor3s(short r, short g, short b) { checkSeal(false); growBufferIfNecessary(COLOR, 3); if(cComps>0) - BufferUtil.puts(colorArray, r); + GLBuffers.puts(colorArray, r); if(cComps>1) - BufferUtil.puts(colorArray, g); + GLBuffers.puts(colorArray, g); if(cComps>2) - BufferUtil.puts(colorArray, b); + GLBuffers.puts(colorArray, b); padding(COLOR, cComps-3); } public void glColor4s(short r, short g, short b, short a) { checkSeal(false); growBufferIfNecessary(COLOR, 4); if(cComps>0) - BufferUtil.puts(colorArray, r); + GLBuffers.puts(colorArray, r); if(cComps>1) - BufferUtil.puts(colorArray, g); + GLBuffers.puts(colorArray, g); if(cComps>2) - BufferUtil.puts(colorArray, b); + GLBuffers.puts(colorArray, b); if(cComps>3) - BufferUtil.puts(colorArray, a); + GLBuffers.puts(colorArray, a); padding(COLOR, cComps-4); } public void glColor3f(float r, float g, float b) { checkSeal(false); growBufferIfNecessary(COLOR, 3); if(cComps>0) - BufferUtil.putf(colorArray, r); + GLBuffers.putf(colorArray, r); if(cComps>1) - BufferUtil.putf(colorArray, g); + GLBuffers.putf(colorArray, g); if(cComps>2) - BufferUtil.putf(colorArray, b); + GLBuffers.putf(colorArray, b); padding(COLOR, cComps-3); } public void glColor4f(float r, float g, float b, float a) { checkSeal(false); growBufferIfNecessary(COLOR, 4); if(cComps>0) - BufferUtil.putf(colorArray, r); + GLBuffers.putf(colorArray, r); if(cComps>1) - BufferUtil.putf(colorArray, g); + GLBuffers.putf(colorArray, g); if(cComps>2) - BufferUtil.putf(colorArray, b); + GLBuffers.putf(colorArray, b); if(cComps>3) - BufferUtil.putf(colorArray, a); + GLBuffers.putf(colorArray, a); padding(COLOR, cComps-4); } @@ -548,60 +548,60 @@ public class ImmModeSink { checkSeal(false); growBufferIfNecessary(TEXTCOORD, 2); if(tComps>0) - BufferUtil.putb(textCoordArray, x); + GLBuffers.putb(textCoordArray, x); if(tComps>1) - BufferUtil.putb(textCoordArray, y); + GLBuffers.putb(textCoordArray, y); padding(TEXTCOORD, tComps-2); } public void glTexCoord3b(byte x, byte y, byte z) { checkSeal(false); growBufferIfNecessary(TEXTCOORD, 3); if(tComps>0) - BufferUtil.putb(textCoordArray, x); + GLBuffers.putb(textCoordArray, x); if(tComps>1) - BufferUtil.putb(textCoordArray, y); + GLBuffers.putb(textCoordArray, y); if(tComps>2) - BufferUtil.putb(textCoordArray, z); + GLBuffers.putb(textCoordArray, z); padding(TEXTCOORD, tComps-3); } public void glTexCoord2s(short x, short y) { checkSeal(false); growBufferIfNecessary(TEXTCOORD, 2); if(tComps>0) - BufferUtil.puts(textCoordArray, x); + GLBuffers.puts(textCoordArray, x); if(tComps>1) - BufferUtil.puts(textCoordArray, y); + GLBuffers.puts(textCoordArray, y); padding(TEXTCOORD, tComps-2); } public void glTexCoord3s(short x, short y, short z) { checkSeal(false); growBufferIfNecessary(TEXTCOORD, 3); if(tComps>0) - BufferUtil.puts(textCoordArray, x); + GLBuffers.puts(textCoordArray, x); if(tComps>1) - BufferUtil.puts(textCoordArray, y); + GLBuffers.puts(textCoordArray, y); if(tComps>2) - BufferUtil.puts(textCoordArray, z); + GLBuffers.puts(textCoordArray, z); padding(TEXTCOORD, tComps-3); } public void glTexCoord2f(float x, float y) { checkSeal(false); growBufferIfNecessary(TEXTCOORD, 2); if(tComps>0) - BufferUtil.putf(textCoordArray, x); + GLBuffers.putf(textCoordArray, x); if(tComps>1) - BufferUtil.putf(textCoordArray, y); + GLBuffers.putf(textCoordArray, y); padding(TEXTCOORD, tComps-2); } public void glTexCoord3f(float x, float y, float z) { checkSeal(false); growBufferIfNecessary(TEXTCOORD, 3); if(tComps>0) - BufferUtil.putf(textCoordArray, x); + GLBuffers.putf(textCoordArray, x); if(tComps>1) - BufferUtil.putf(textCoordArray, y); + GLBuffers.putf(textCoordArray, y); if(tComps>2) - BufferUtil.putf(textCoordArray, z); + GLBuffers.putf(textCoordArray, z); padding(TEXTCOORD, tComps-3); } @@ -809,20 +809,20 @@ public class ImmModeSink { // non public matters protected void allocateBuffer(int elements) { - int vWidth = vComps * BufferUtil.sizeOfGLType(vDataType); - int cWidth = cComps * BufferUtil.sizeOfGLType(cDataType); - int nWidth = nComps * BufferUtil.sizeOfGLType(nDataType); - int tWidth = tComps * BufferUtil.sizeOfGLType(tDataType); + int vWidth = vComps * GLBuffers.sizeOfGLType(vDataType); + int cWidth = cComps * GLBuffers.sizeOfGLType(cDataType); + int nWidth = nComps * GLBuffers.sizeOfGLType(nDataType); + int tWidth = tComps * GLBuffers.sizeOfGLType(tDataType); count = elements; bSize = count * ( vWidth + cWidth + nWidth + tWidth ) ; - buffer = BufferUtil.newDirectByteBuffer(bSize); + buffer = GLBuffers.newDirectByteBuffer(bSize); int pos = 0; int size= count * vWidth ; if(size>0) { - vertexArray = BufferUtil.sliceGLBuffer(buffer, pos, size, vDataType); + vertexArray = GLBuffers.sliceGLBuffer(buffer, pos, size, vDataType); } else { vertexArray = null; } @@ -831,7 +831,7 @@ public class ImmModeSink { size= count * cWidth ; if(size>0) { - colorArray = BufferUtil.sliceGLBuffer(buffer, pos, size, cDataType); + colorArray = GLBuffers.sliceGLBuffer(buffer, pos, size, cDataType); } else { colorArray = null; } @@ -840,7 +840,7 @@ public class ImmModeSink { size= count * nWidth ; if(size>0) { - normalArray = BufferUtil.sliceGLBuffer(buffer, pos, size, nDataType); + normalArray = GLBuffers.sliceGLBuffer(buffer, pos, size, nDataType); } else { normalArray = null; } @@ -849,7 +849,7 @@ public class ImmModeSink { size= count * tWidth ; if(size>0) { - textCoordArray = BufferUtil.sliceGLBuffer(buffer, pos, size, tDataType); + textCoordArray = GLBuffers.sliceGLBuffer(buffer, pos, size, tDataType); } else { textCoordArray = null; } @@ -905,19 +905,19 @@ public class ImmModeSink { if(null!=_vertexArray) { _vertexArray.flip(); - BufferUtil.put(vertexArray, _vertexArray); + GLBuffers.put(vertexArray, _vertexArray); } if(null!=_colorArray) { _colorArray.flip(); - BufferUtil.put(colorArray, _colorArray); + GLBuffers.put(colorArray, _colorArray); } if(null!=_normalArray) { _normalArray.flip(); - BufferUtil.put(normalArray, _normalArray); + GLBuffers.put(normalArray, _normalArray); } if(null!=_textCoordArray) { _textCoordArray.flip(); - BufferUtil.put(textCoordArray, _textCoordArray); + GLBuffers.put(textCoordArray, _textCoordArray); } } @@ -944,7 +944,7 @@ public class ImmModeSink { if ( null==dest ) return; while((fill--)>0) { - BufferUtil.putb(dest, (byte)0); + GLBuffers.putb(dest, (byte)0); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/StreamUtil.java b/src/jogl/classes/com/jogamp/opengl/util/StreamUtil.java index 83186f6a0..4cf8cb1f0 100755 --- a/src/jogl/classes/com/jogamp/opengl/util/StreamUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/StreamUtil.java @@ -59,7 +59,7 @@ public class StreamUtil { public static ByteBuffer readAll2Buffer(InputStream stream) throws IOException { BytesRead bytesRead = readAllImpl(stream); - return BufferUtil.newDirectByteBuffer(bytesRead.data, 0, bytesRead.payloadLen); + return GLBuffers.newDirectByteBuffer(bytesRead.data, 0, bytesRead.payloadLen); } private static BytesRead readAllImpl(InputStream stream) throws IOException { 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 b69cc2b72..2276cc835 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.newDirectFloatBuffer(m, m_offset)); + glLoadMatrixf(GLBuffers.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.newDirectFloatBuffer(m, m_offset)); + glMultMatrixf(GLBuffers.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.newDirectFloatBuffer(new float[] { red, green, blue, alpha })); + fixedFunction.glColor4fv(gl, GLBuffers.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.newDirectFloatBuffer(params, params_offset)); + glLightfv(light, pname, GLBuffers.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.newDirectFloatBuffer(params, params_offset)); + glMaterialfv(face, pname, GLBuffers.newDirectFloatBuffer(params, params_offset)); } public void glMaterialf(int face, int pname, float param) { - glMaterialfv(face, pname, BufferUtil.newDirectFloatBuffer(new float[] { param })); + glMaterialfv(face, pname, GLBuffers.newDirectFloatBuffer(new float[] { param })); } public void glShadeModel(int mode) { fixedFunction.glShadeModel(gl, mode); diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java index 9a28f3316..f598422bf 100755 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java @@ -365,6 +365,6 @@ public class TextureData { if (buffer == null) { return 0; } - return buffer.capacity() * BufferUtil.sizeOfBufferElem(buffer); + return buffer.capacity() * GLBuffers.sizeOfBufferElem(buffer); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp index 2ed1299da..b18991dfc 100755 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp @@ -478,7 +478,7 @@ public class DDSImage { } if (size == 0) size = 1; - return BufferUtil.newDirectByteBuffer(size); + return GLBuffers.newDirectByteBuffer(size); } public void debugPrint() { diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javase b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javase index 4e9294870..e3092162d 100755 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javase +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javase @@ -503,7 +503,7 @@ public class DDSImage { } if (size == 0) size = 1; - return BufferUtil.newDirectByteBuffer(size); + return GLBuffers.newDirectByteBuffer(size); } public void debugPrint() { -- cgit v1.2.3