diff options
Diffstat (limited to 'src/jogl/classes/com')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java | 8 | ||||
-rwxr-xr-x | src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java (renamed from src/jogl/classes/com/jogamp/opengl/util/BufferUtil.java) | 21 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java | 156 | ||||
-rwxr-xr-x | src/jogl/classes/com/jogamp/opengl/util/StreamUtil.java | 2 | ||||
-rwxr-xr-x | src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java | 12 | ||||
-rwxr-xr-x | src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java | 2 | ||||
-rwxr-xr-x | src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp | 2 | ||||
-rwxr-xr-x | src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javase | 2 |
8 files changed, 93 insertions, 112 deletions
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/BufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java index 41baf03d7..b49bb3364 100755 --- a/src/jogl/classes/com/jogamp/opengl/util/BufferUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java @@ -50,7 +50,7 @@ import java.nio.*; * @author Kenneth Russel * @author Michael Bien */ -public class BufferUtil extends Buffers { +public class GLBuffers extends Buffers { public static final int sizeOfGLType(int glType) { switch (glType) { @@ -76,25 +76,6 @@ public class BufferUtil extends Buffers { 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: 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() { |