summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-03-30 02:01:28 +0200
committerSven Gothel <[email protected]>2010-03-30 02:01:28 +0200
commit62dcd1a3fe345c4d2c0e42472d2c7646fe224e8f (patch)
tree9841146ffc54d1bd8a675e38a123bf82d019db96 /src/jogl/classes
parent1a2a54a83a9adb95b4bfe9c337751acbef0cb0d3 (diff)
parent476d1d755b6d9c5650779aedda1265917a6dec6e (diff)
Merge branch 'master' of github.com:mbien/jogl
Diffstat (limited to 'src/jogl/classes')
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/BufferUtil.java.javame_cdc_fp449
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/BufferUtil.java.javase499
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java21
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java8
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/GLBuffers.java137
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java160
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java11
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/StreamUtil.java2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/TGAWriter.java8
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java5
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java5
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java13
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java59
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java8
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java12
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncPipeline.java22
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java21
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javase2
-rw-r--r--src/jogl/classes/javax/media/opengl/GLArrayData.java10
-rw-r--r--src/jogl/classes/javax/media/opengl/GLBase.java2
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java6
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawableFactory.java4
-rw-r--r--src/jogl/classes/javax/media/opengl/GLUniformData.java2
-rw-r--r--src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java4
26 files changed, 331 insertions, 1143 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/BufferUtil.java.javame_cdc_fp b/src/jogl/classes/com/jogamp/opengl/util/BufferUtil.java.javame_cdc_fp
deleted file mode 100755
index 2f82487f8..000000000
--- a/src/jogl/classes/com/jogamp/opengl/util/BufferUtil.java.javame_cdc_fp
+++ /dev/null
@@ -1,449 +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 javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-
-import java.nio.*;
-import java.util.*;
-
-import java.lang.reflect.*;
-
-/** Utility routines for dealing with direct buffers. */
-
-public class BufferUtil {
- public static final int SIZEOF_BYTE = 1;
- public static final int SIZEOF_SHORT = 2;
- public static final int SIZEOF_INT = 4;
- public static final int SIZEOF_FLOAT = 4;
- public static final int SIZEOF_LONG = -1; // not supported
- public static final int SIZEOF_DOUBLE = -1; // not supported
-
- 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;
- }
- throw new RuntimeException("Unexpected buffer type " +
- buffer.getClass().getName());
- }
-
- private BufferUtil() {}
-
- //----------------------------------------------------------------------
- // Allocation routines
- //
-
- public static final Buffer newGLBuffer(int glType, int numElements) {
- switch (glType) {
- case GL.GL_UNSIGNED_BYTE:
- case GL.GL_BYTE:
- return newByteBuffer(numElements);
- case GL.GL_UNSIGNED_SHORT:
- case GL.GL_SHORT:
- return newShortBuffer(numElements);
- case GL.GL_FLOAT:
- return newFloatBuffer(numElements);
- case GL.GL_FIXED:
- case GL2ES2.GL_INT:
- case GL2ES2.GL_UNSIGNED_INT:
- return newIntBuffer(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();
- }
- return null;
- }
-
- /** Allocates a new direct ByteBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static ByteBuffer newByteBuffer(int numElements) {
- ByteBuffer bb = ByteBuffer.allocateDirect(numElements);
- nativeOrder(bb);
- return bb;
- }
-
- public static ByteBuffer newByteBuffer(byte[] values, int offset, int len) {
- ByteBuffer bb = newByteBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static ByteBuffer newByteBuffer(byte[] values, int offset) {
- return newByteBuffer(values, offset, values.length-offset);
- }
-
- public static ByteBuffer newByteBuffer(byte[] values) {
- return newByteBuffer(values, 0);
- }
-
- /** Allocates a new direct FloatBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static FloatBuffer newFloatBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_FLOAT);
- return bb.asFloatBuffer();
- }
-
- public static FloatBuffer newFloatBuffer(float[] values, int offset, int len) {
- FloatBuffer bb = newFloatBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static FloatBuffer newFloatBuffer(float[] values, int offset) {
- return newFloatBuffer(values, 0, values.length-offset);
- }
-
- public static FloatBuffer newFloatBuffer(float[] values) {
- return newFloatBuffer(values, 0);
- }
-
- /** Allocates a new direct IntBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static IntBuffer newIntBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_INT);
- return bb.asIntBuffer();
- }
-
- public static IntBuffer newIntBuffer(int[] values, int offset, int len) {
- IntBuffer bb = newIntBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static IntBuffer newIntBuffer(int[] values, int offset) {
- return newIntBuffer(values, 0, values.length-offset);
- }
-
- public static IntBuffer newIntBuffer(int[] values) {
- return newIntBuffer(values, 0);
- }
-
-
- /** Allocates a new direct ShortBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static ShortBuffer newShortBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_SHORT);
- return bb.asShortBuffer();
- }
-
- public static ShortBuffer newShortBuffer(short[] values, int offset, int len) {
- ShortBuffer bb = newShortBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static ShortBuffer newShortBuffer(short[] values, int offset) {
- return newShortBuffer(values, 0, values.length-offset);
- }
-
- public static ShortBuffer newShortBuffer(short[] values) {
- return newShortBuffer(values, 0);
- }
-
-
- //----------------------------------------------------------------------
- // Copy routines (type-to-type)
- //
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed ByteBuffer into
- a newly-allocated direct ByteBuffer. The returned buffer will
- have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyByteBuffer(ByteBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining());
- dest.put(orig);
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed FloatBuffer
- into a newly-allocated direct FloatBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static FloatBuffer copyFloatBuffer(FloatBuffer orig) {
- return copyFloatBufferAsByteBuffer(orig).asFloatBuffer();
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed IntBuffer
- into a newly-allocated direct IntBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static IntBuffer copyIntBuffer(IntBuffer orig) {
- return copyIntBufferAsByteBuffer(orig).asIntBuffer();
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed ShortBuffer
- into a newly-allocated direct ShortBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ShortBuffer copyShortBuffer(ShortBuffer orig) {
- return copyShortBufferAsByteBuffer(orig).asShortBuffer();
- }
-
- //----------------------------------------------------------------------
- // Copy routines (type-to-ByteBuffer)
- //
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed FloatBuffer
- into a newly-allocated direct ByteBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyFloatBufferAsByteBuffer(FloatBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_FLOAT);
- dest.asFloatBuffer().put(orig);
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed IntBuffer into
- a newly-allocated direct ByteBuffer. The returned buffer will
- have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyIntBufferAsByteBuffer(IntBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_INT);
- dest.asIntBuffer().put(orig);
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed ShortBuffer
- into a newly-allocated direct ByteBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyShortBufferAsByteBuffer(ShortBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_SHORT);
- dest.asShortBuffer().put(orig);
- dest.rewind();
- return dest;
- }
-
- //----------------------------------------------------------------------
- // 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;
- }
-
- public static ByteBuffer nativeOrder(ByteBuffer buf) {
- if (!isCDCFP) {
- try {
- if (byteOrderClass == null) {
- byteOrderClass = Class.forName("java.nio.ByteOrder");
- orderMethod = ByteBuffer.class.getMethod("order", new Class[] { byteOrderClass });
- Method nativeOrderMethod = byteOrderClass.getMethod("nativeOrder", null);
- nativeOrderObject = nativeOrderMethod.invoke(null, null);
- }
- } catch (Throwable t) {
- // Must be running on CDC / FP
- isCDCFP = true;
- }
-
- if (!isCDCFP) {
- try {
- orderMethod.invoke(buf, new Object[] { nativeOrderObject });
- } catch (Throwable t) {
- }
- }
- }
- return buf;
- }
-
- //----------------------------------------------------------------------
- // Convenient GL put methods with generic target Buffer
- //
- public static void put(Buffer dest, Buffer v) {
- if((dest instanceof ByteBuffer) && (v instanceof ByteBuffer)) {
- ((ByteBuffer)dest).put((ByteBuffer)v);
- } else if((dest instanceof ShortBuffer) && (v instanceof ShortBuffer)) {
- ((ShortBuffer)dest).put((ShortBuffer)v);
- } else if((dest instanceof IntBuffer) && (v instanceof IntBuffer)) {
- ((IntBuffer)dest).put((IntBuffer)v);
- } else if((dest instanceof FloatBuffer) && (v instanceof FloatBuffer)) {
- ((FloatBuffer)dest).put((FloatBuffer)v);
- } else {
- throw new GLException("Incompatible Buffer classes: dest = "+dest.getClass().getName() + ", src = " + v.getClass().getName());
- }
- }
-
- public static void putb(Buffer dest, byte v) {
- if(dest instanceof ByteBuffer) {
- ((ByteBuffer)dest).put(v);
- } else if(dest instanceof ShortBuffer) {
- ((ShortBuffer)dest).put((short)v);
- } else if(dest instanceof IntBuffer) {
- ((IntBuffer)dest).put((int)v);
- } else {
- throw new GLException("Byte doesn't match Buffer Class: "+dest);
- }
- }
-
- public static void puts(Buffer dest, short v) {
- if(dest instanceof ShortBuffer) {
- ((ShortBuffer)dest).put(v);
- } else if(dest instanceof IntBuffer) {
- ((IntBuffer)dest).put((int)v);
- } else {
- throw new GLException("Short doesn't match Buffer Class: "+dest);
- }
- }
-
- public static void puti(Buffer dest, int v) {
- if(dest instanceof IntBuffer) {
- ((IntBuffer)dest).put(v);
- } else {
- throw new GLException("Integer doesn't match Buffer Class: "+dest);
- }
- }
-
- public static void putx(Buffer dest, int v) {
- puti(dest, v);
- }
-
- public static void putf(Buffer dest, float v) {
- if(dest instanceof FloatBuffer) {
- ((FloatBuffer)dest).put(v);
- } else if(dest instanceof IntBuffer) {
- ((IntBuffer)dest).put(FixedPoint.toFixed(v));
- } else {
- throw new GLException("Float doesn't match Buffer Class: "+dest);
- }
- }
-
- //----------------------------------------------------------------------
- // Internals only below this point
- //
-
- // NOTE that this work must be done reflectively at the present time
- // because this code must compile and run correctly on both CDC/FP and J2SE
- private static boolean isCDCFP;
- private static Class byteOrderClass;
- private static Object nativeOrderObject;
- private static Method orderMethod;
-
-}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/BufferUtil.java.javase b/src/jogl/classes/com/jogamp/opengl/util/BufferUtil.java.javase
deleted file mode 100755
index fde1e8681..000000000
--- a/src/jogl/classes/com/jogamp/opengl/util/BufferUtil.java.javase
+++ /dev/null
@@ -1,499 +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 javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-
-import java.nio.*;
-import java.util.*;
-
-import java.lang.reflect.*;
-
-/** Utility routines for dealing with direct buffers. */
-
-public class BufferUtil {
- public static final int SIZEOF_BYTE = 1;
- public static final int SIZEOF_SHORT = 2;
- public static final int SIZEOF_INT = 4;
- public static final int SIZEOF_FLOAT = 4;
- public static final int SIZEOF_LONG = 8;
- public static final int SIZEOF_DOUBLE = 8;
-
- 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());
- }
-
- private BufferUtil() {}
-
- //----------------------------------------------------------------------
- // Allocation routines
- //
-
- public static final Buffer newGLBuffer(int glType, int numElements) {
- switch (glType) {
- case GL.GL_UNSIGNED_BYTE:
- case GL.GL_BYTE:
- return newByteBuffer(numElements);
- case GL.GL_UNSIGNED_SHORT:
- case GL.GL_SHORT:
- return newShortBuffer(numElements);
- case GL.GL_FLOAT:
- return newFloatBuffer(numElements);
- case GL.GL_FIXED:
- case GL2ES2.GL_INT:
- case GL2ES2.GL_UNSIGNED_INT:
- return newIntBuffer(numElements);
- case GL2.GL_DOUBLE:
- return newDoubleBuffer(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;
- }
-
- /** Allocates a new direct ByteBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static ByteBuffer newByteBuffer(int numElements) {
- ByteBuffer bb = ByteBuffer.allocateDirect(numElements);
- nativeOrder(bb);
- return bb;
- }
-
- public static ByteBuffer newByteBuffer(byte[] values, int offset, int len) {
- ByteBuffer bb = newByteBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static ByteBuffer newByteBuffer(byte[] values, int offset) {
- return newByteBuffer(values, offset, values.length-offset);
- }
-
- public static ByteBuffer newByteBuffer(byte[] values) {
- return newByteBuffer(values, 0);
- }
-
-
- /** Allocates a new direct DoubleBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static DoubleBuffer newDoubleBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_DOUBLE);
- return bb.asDoubleBuffer();
- }
-
- public static DoubleBuffer newDoubleBuffer(double[] values, int offset) {
- int len = values.length-offset;
- DoubleBuffer bb = newDoubleBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static DoubleBuffer newDoubleBuffer(double[] values) {
- return newDoubleBuffer(values, 0);
- }
-
-
- /** Allocates a new direct FloatBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static FloatBuffer newFloatBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_FLOAT);
- return bb.asFloatBuffer();
- }
-
- public static FloatBuffer newFloatBuffer(float[] values, int offset, int len) {
- FloatBuffer bb = newFloatBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static FloatBuffer newFloatBuffer(float[] values, int offset) {
- return newFloatBuffer(values, 0, values.length-offset);
- }
-
- public static FloatBuffer newFloatBuffer(float[] values) {
- return newFloatBuffer(values, 0);
- }
-
-
- /** Allocates a new direct IntBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static IntBuffer newIntBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_INT);
- return bb.asIntBuffer();
- }
-
- public static IntBuffer newIntBuffer(int[] values, int offset, int len) {
- IntBuffer bb = newIntBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static IntBuffer newIntBuffer(int[] values, int offset) {
- return newIntBuffer(values, 0, values.length-offset);
- }
-
- public static IntBuffer newIntBuffer(int[] values) {
- return newIntBuffer(values, 0);
- }
-
- /** Allocates a new direct LongBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static LongBuffer newLongBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_LONG);
- return bb.asLongBuffer();
- }
-
- /** Allocates a new direct ShortBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static ShortBuffer newShortBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_SHORT);
- return bb.asShortBuffer();
- }
-
- public static ShortBuffer newShortBuffer(short[] values, int offset, int len) {
- ShortBuffer bb = newShortBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static ShortBuffer newShortBuffer(short[] values, int offset) {
- return newShortBuffer(values, 0, values.length-offset);
- }
-
- public static ShortBuffer newShortBuffer(short[] values) {
- return newShortBuffer(values, 0);
- }
-
- //----------------------------------------------------------------------
- // Copy routines (type-to-type)
- //
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed ByteBuffer into
- a newly-allocated direct ByteBuffer. The returned buffer will
- have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyByteBuffer(ByteBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining());
- dest.put(orig);
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed FloatBuffer
- into a newly-allocated direct FloatBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static FloatBuffer copyFloatBuffer(FloatBuffer orig) {
- return copyFloatBufferAsByteBuffer(orig).asFloatBuffer();
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed IntBuffer
- into a newly-allocated direct IntBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static IntBuffer copyIntBuffer(IntBuffer orig) {
- return copyIntBufferAsByteBuffer(orig).asIntBuffer();
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed ShortBuffer
- into a newly-allocated direct ShortBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ShortBuffer copyShortBuffer(ShortBuffer orig) {
- return copyShortBufferAsByteBuffer(orig).asShortBuffer();
- }
-
- //----------------------------------------------------------------------
- // Copy routines (type-to-ByteBuffer)
- //
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed FloatBuffer
- into a newly-allocated direct ByteBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyFloatBufferAsByteBuffer(FloatBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_FLOAT);
- dest.asFloatBuffer().put(orig);
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed IntBuffer into
- a newly-allocated direct ByteBuffer. The returned buffer will
- have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyIntBufferAsByteBuffer(IntBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_INT);
- dest.asIntBuffer().put(orig);
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed ShortBuffer
- into a newly-allocated direct ByteBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyShortBufferAsByteBuffer(ShortBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_SHORT);
- dest.asShortBuffer().put(orig);
- dest.rewind();
- return dest;
- }
-
- //----------------------------------------------------------------------
- // 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;
- }
-
- public final static FloatBuffer getFloatBuffer(DoubleBuffer source) {
- source.rewind();
- FloatBuffer dest = BufferUtil.newFloatBuffer(source.limit());
- while(source.hasRemaining()) { dest.put((float)source.get()); }
- return dest;
- }
-
- public static ByteBuffer nativeOrder(ByteBuffer buf) {
- if (!isCDCFP) {
- try {
- if (byteOrderClass == null) {
- byteOrderClass = Class.forName("java.nio.ByteOrder");
- orderMethod = ByteBuffer.class.getMethod("order", new Class[] { byteOrderClass });
- Method nativeOrderMethod = byteOrderClass.getMethod("nativeOrder", null);
- nativeOrderObject = nativeOrderMethod.invoke(null, null);
- }
- } catch (Throwable t) {
- // Must be running on CDC / FP
- isCDCFP = true;
- }
-
- if (!isCDCFP) {
- try {
- orderMethod.invoke(buf, new Object[] { nativeOrderObject });
- } catch (Throwable t) {
- }
- }
- }
- return buf;
- }
-
- //----------------------------------------------------------------------
- // Convenient GL put methods with generic target Buffer
- //
- public static void put(Buffer dest, Buffer v) {
- if((dest instanceof ByteBuffer) && (v instanceof ByteBuffer)) {
- ((ByteBuffer)dest).put((ByteBuffer)v);
- } else if((dest instanceof ShortBuffer) && (v instanceof ShortBuffer)) {
- ((ShortBuffer)dest).put((ShortBuffer)v);
- } else if((dest instanceof IntBuffer) && (v instanceof IntBuffer)) {
- ((IntBuffer)dest).put((IntBuffer)v);
- } else if((dest instanceof FloatBuffer) && (v instanceof FloatBuffer)) {
- ((FloatBuffer)dest).put((FloatBuffer)v);
- } else {
- throw new GLException("Incompatible Buffer classes: dest = "+dest.getClass().getName() + ", src = " + v.getClass().getName());
- }
- }
-
- public static void putb(Buffer dest, byte v) {
- if(dest instanceof ByteBuffer) {
- ((ByteBuffer)dest).put(v);
- } else if(dest instanceof ShortBuffer) {
- ((ShortBuffer)dest).put((short)v);
- } else if(dest instanceof IntBuffer) {
- ((IntBuffer)dest).put((int)v);
- } else {
- throw new GLException("Byte doesn't match Buffer Class: "+dest);
- }
- }
-
- public static void puts(Buffer dest, short v) {
- if(dest instanceof ShortBuffer) {
- ((ShortBuffer)dest).put(v);
- } else if(dest instanceof IntBuffer) {
- ((IntBuffer)dest).put((int)v);
- } else {
- throw new GLException("Short doesn't match Buffer Class: "+dest);
- }
- }
-
- public static void puti(Buffer dest, int v) {
- if(dest instanceof IntBuffer) {
- ((IntBuffer)dest).put(v);
- } else {
- throw new GLException("Integer doesn't match Buffer Class: "+dest);
- }
- }
-
- public static void putx(Buffer dest, int v) {
- puti(dest, v);
- }
-
- public static void putf(Buffer dest, float v) {
- if(dest instanceof FloatBuffer) {
- ((FloatBuffer)dest).put(v);
- } else if(dest instanceof IntBuffer) {
- ((IntBuffer)dest).put(FixedPoint.toFixed(v));
- } else {
- throw new GLException("Float doesn't match Buffer Class: "+dest);
- }
- }
-
- public static void putd(Buffer dest, double v) {
- if(dest instanceof FloatBuffer) {
- ((FloatBuffer)dest).put((float)v);
- } else {
- throw new GLException("Double doesn't match Buffer Class: "+dest);
- }
- }
-
- //----------------------------------------------------------------------
- // Internals only below this point
- //
-
- // NOTE that this work must be done reflectively at the present time
- // because this code must compile and run correctly on both CDC/FP and J2SE
- private static boolean isCDCFP;
- private static Class byteOrderClass;
- private static Object nativeOrderObject;
- private static Method orderMethod;
-
-}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
index f8951f0fd..d41e4b922 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
@@ -1,6 +1,7 @@
package com.jogamp.opengl.util;
+import com.jogamp.gluegen.runtime.Buffers;
import java.security.*;
import javax.media.opengl.*;
@@ -189,7 +190,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
public void padding(int done) {
if ( buffer==null || sealed ) return;
while(done<strideL) {
- BufferUtil.putb(buffer, (byte)0);
+ Buffers.putb(buffer, (byte)0);
done++;
}
}
@@ -206,25 +207,25 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
throw new GLException("Buffer length ("+v.remaining()+") is not a multiple of component-stride:\n\t"+this);
}
growBufferIfNecessary(v.remaining());
- BufferUtil.put(buffer, v);
+ Buffers.put(buffer, v);
}
public void putb(byte v) {
if ( buffer==null || sealed ) return;
growBufferIfNecessary(1);
- BufferUtil.putb(buffer, v);
+ Buffers.putb(buffer, v);
}
public void puts(short v) {
if ( buffer==null || sealed ) return;
growBufferIfNecessary(1);
- BufferUtil.puts(buffer, v);
+ Buffers.puts(buffer, v);
}
public void puti(int v) {
if ( buffer==null || sealed ) return;
growBufferIfNecessary(1);
- BufferUtil.puti(buffer, v);
+ Buffers.puti(buffer, v);
}
public void putx(int v) {
@@ -234,7 +235,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
public void putf(float v) {
if ( buffer==null || sealed ) return;
growBufferIfNecessary(1);
- BufferUtil.putf(buffer, v);
+ Buffers.putf(buffer, v);
}
public String toString() {
@@ -274,28 +275,28 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
if(components>0) {
int osize = (buffer!=null)?buffer.capacity():0;
if(clazz==ByteBuffer.class) {
- ByteBuffer newBBuffer = BufferUtil.newByteBuffer( (osize+additional) * components );
+ ByteBuffer newBBuffer = Buffers.newDirectByteBuffer( (osize+additional) * components );
if(buffer!=null) {
buffer.flip();
newBBuffer.put((ByteBuffer)buffer);
}
buffer = newBBuffer;
} else if(clazz==ShortBuffer.class) {
- ShortBuffer newSBuffer = BufferUtil.newShortBuffer( (osize+additional) * components );
+ ShortBuffer newSBuffer = Buffers.newDirectShortBuffer( (osize+additional) * components );
if(buffer!=null) {
buffer.flip();
newSBuffer.put((ShortBuffer)buffer);
}
buffer = newSBuffer;
} else if(clazz==IntBuffer.class) {
- IntBuffer newIBuffer = BufferUtil.newIntBuffer( (osize+additional) * components );
+ IntBuffer newIBuffer = Buffers.newDirectIntBuffer( (osize+additional) * components );
if(buffer!=null) {
buffer.flip();
newIBuffer.put((IntBuffer)buffer);
}
buffer = newIBuffer;
} else if(clazz==FloatBuffer.class) {
- FloatBuffer newFBuffer = BufferUtil.newFloatBuffer( (osize+additional) * components );
+ FloatBuffer newFBuffer = Buffers.newDirectFloatBuffer( (osize+additional) * components );
if(buffer!=null) {
buffer.flip();
newFBuffer.put((FloatBuffer)buffer);
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 7c71c4309..ad230a415 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
@@ -35,8 +35,8 @@ public class ImmModeSink {
* a ShaderState must be current, using ShaderState.glUseProgram().
*
* @see #draw(GL, boolean)
- * @see javax.media.opengl.glsl.ShaderState#glUseProgram(GL2ES2, boolean)
- * @see javax.media.opengl.glsl.ShaderState#getCurrent()
+ * @see com.jogamp.opengl.util.glsl.ShaderState#glUseProgram(GL2ES2, boolean)
+ * @see com.jogamp.opengl.util.glsl.ShaderState#getCurrent()
*/
public static ImmModeSink createGLSL(GL gl, int glBufferUsage, int initialSize,
int vComps, int vDataType,
@@ -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.newByteBuffer(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/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
index 9cf41804f..4ca8ff197 100755
--- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
@@ -33,6 +33,7 @@
package com.jogamp.opengl.util;
+import com.jogamp.gluegen.runtime.Buffers;
import com.jogamp.opengl.impl.ProjectFloat;
import java.nio.*;
@@ -47,7 +48,7 @@ public class PMVMatrix implements GLMatrixFunc {
public PMVMatrix() {
projectFloat = new ProjectFloat();
- matrixIdent = BufferUtil.newFloatBuffer(1*16);
+ matrixIdent = Buffers.newDirectFloatBuffer(1*16);
projectFloat.gluMakeIdentityf(matrixIdent);
matrixIdent.rewind();
@@ -57,7 +58,7 @@ public class PMVMatrix implements GLMatrixFunc {
// Mvi Modelview-Inverse
// Mvit Modelview-Inverse-Transpose
// Pmv P * Mv
- matrixTPMvMvitPmv = BufferUtil.newFloatBuffer(6*16); // grouping T + P + Mv + Mvi + Mvit + Pmv
+ matrixTPMvMvitPmv = Buffers.newDirectFloatBuffer(6*16); // grouping T + P + Mv + Mvi + Mvit + Pmv
matrixPMvMvitPmv = slice(matrixTPMvMvitPmv, 1*16, 5*16); // grouping P + Mv + Mvi + Mvit + Pmv
matrixT = slice(matrixTPMvMvitPmv, 0*16, 1*16); // T
matrixPMvMvit = slice(matrixTPMvMvitPmv, 1*16, 4*16); // grouping P + Mv + Mvi + Mvit
@@ -70,9 +71,9 @@ public class PMVMatrix implements GLMatrixFunc {
matrixPmv = slice(matrixTPMvMvitPmv, 5*16, 1*16); // Pmv
matrixTPMvMvitPmv.rewind();
- matrixMvit3 = BufferUtil.newFloatBuffer(3*3);
+ matrixMvit3 = Buffers.newDirectFloatBuffer(3*3);
- localBuf = BufferUtil.newFloatBuffer(6*16);
+ localBuf = Buffers.newDirectFloatBuffer(6*16);
matrixMult=slice(localBuf, 0*16, 16);
@@ -294,7 +295,7 @@ public class PMVMatrix implements GLMatrixFunc {
}
/**
- * @param pname GL_MODELVIEW, GL_PROJECTION or GL.GL_TEXTURE
+ * @param matrixName GL_MODELVIEW, GL_PROJECTION or GL.GL_TEXTURE
* @return the given matrix
*/
public final FloatBuffer glGetMatrixf(final int matrixName) {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/StreamUtil.java b/src/jogl/classes/com/jogamp/opengl/util/StreamUtil.java
index 294f86303..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.newByteBuffer(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/TGAWriter.java b/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java
index c53cafdcb..b949f0e39 100755
--- a/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java
@@ -42,13 +42,11 @@ import java.nio.channels.*;
/**
* Utility class which helps take fast screenshots of OpenGL rendering
- * results into Targa-format files. Used by the {@link
- * com.jogamp.opengl.util.gl2.Screenshot Screenshot} class; can also be used
- * in conjunction with the {@link com.jogamp.opengl.util.gl2.TileRenderer
- * TileRenderer} class. <P>
+ * results into Targa-format files. Used by the {@link com.jogamp.opengl.util.awt.Screenshot}
+ * class; can also be used in conjunction with the {@link com.jogamp.opengl.util.gl2.TileRenderer} class.
*/
-
public class TGAWriter {
+
private static final int TARGA_HEADER_SIZE = 18;
private FileChannel ch;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
index 1fbdade4e..4de2e5974 100755
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
@@ -38,6 +38,7 @@
*/
package com.jogamp.opengl.util.awt;
+import com.jogamp.gluegen.runtime.Buffers;
import com.jogamp.opengl.impl.Debug;
import com.jogamp.opengl.util.*;
import com.jogamp.opengl.util.packrect.*;
@@ -1707,8 +1708,8 @@ public class TextRenderer {
Pipelined_QuadRenderer() {
GL2 gl = GLContext.getCurrentGL().getGL2();
- mVertCoords = BufferUtil.newFloatBuffer(kTotalBufferSizeCoordsVerts);
- mTexCoords = BufferUtil.newFloatBuffer(kTotalBufferSizeCoordsTex);
+ mVertCoords = Buffers.newDirectFloatBuffer(kTotalBufferSizeCoordsVerts);
+ mTexCoords = Buffers.newDirectFloatBuffer(kTotalBufferSizeCoordsTex);
usingVBOs = is15Available(gl);
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/ShaderProgram.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
index 49a341cc6..430ed08ce 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
@@ -5,7 +5,6 @@ import javax.media.opengl.*;
import java.util.HashMap;
import java.util.Iterator;
-import java.nio.*;
import java.io.PrintStream;
public class ShaderProgram {
@@ -104,16 +103,20 @@ public class ShaderProgram {
* Refetches all previously bin/get attribute names
* and resets all attribute data as well
*
- * @see getAttribLocation
* @param gl
* @param oldShaderID the to be replace Shader
* @param newShader the new ShaderCode
* @param verboseOut the optional verbose outputstream
* @throws GLException is the program is not linked
*
- * @see #glRefetchAttribLocations
- * @see #glResetAllVertexAttributes
- * @see #glReplaceShader
+ * @see ShaderState#glEnableVertexAttribArray
+ * @see ShaderState#glDisableVertexAttribArray
+ * @see ShaderState#glVertexAttribPointer
+ * @see ShaderState#getVertexAttribPointer
+ * @see ShaderState#glReleaseAllVertexAttributes
+ * @see ShaderState#glResetAllVertexAttributes
+ * @see ShaderState#glResetAllVertexAttributes
+ * @see ShaderState#glResetAllVertexAttributes
*/
public synchronized boolean glReplaceShader(GL2ES2 gl, int oldShaderID, ShaderCode newShader, PrintStream verboseOut) {
if(!programLinked) throw new GLException("Program is not linked");
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
index 33f6e210b..86f9251b7 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
@@ -2,14 +2,11 @@
package com.jogamp.opengl.util.glsl;
import javax.media.opengl.*;
-import com.jogamp.opengl.util.*;
import com.jogamp.opengl.impl.Debug;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.nio.*;
-import java.io.PrintStream;
import java.security.*;
public class ShaderState {
@@ -25,8 +22,8 @@ public class ShaderState {
/**
* Fetches the current shader state from the thread local storage (TLS)
*
- * @see javax.media.opengl.glsl.ShaderState#glUseProgram(GL2ES2, boolean)
- * @see javax.media.opengl.glsl.ShaderState#getCurrent()
+ * @see com.jogamp.opengl.util.glsl.ShaderState#glUseProgram(GL2ES2, boolean)
+ * @see com.jogamp.opengl.util.glsl.ShaderState#getCurrent()
*/
public static synchronized ShaderState getCurrent() {
GLContext current = GLContext.getCurrent();
@@ -41,8 +38,8 @@ public class ShaderState {
* Puts this ShaderState to to the thread local storage (TLS),
* if <code>on</code> is <code>true</code>.
*
- * @see javax.media.opengl.glsl.ShaderState#glUseProgram(GL2ES2, boolean)
- * @see javax.media.opengl.glsl.ShaderState#getCurrent()
+ * @see com.jogamp.opengl.util.glsl.ShaderState#glUseProgram(GL2ES2, boolean)
+ * @see com.jogamp.opengl.util.glsl.ShaderState#getCurrent()
*/
public synchronized void glUseProgram(GL2ES2 gl, boolean on) {
if(on) {
@@ -178,7 +175,7 @@ public class ShaderState {
* @see #glGetAttribLocation
* @see javax.media.opengl.GL2ES2#glGetAttribLocation
* @see #getAttribLocation
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public void glBindAttribLocation(GL2ES2 gl, int index, String name) {
if(null==shaderProgram) throw new GLException("No program is attached");
@@ -203,7 +200,7 @@ public class ShaderState {
* @see #glGetAttribLocation
* @see javax.media.opengl.GL2ES2#glGetAttribLocation
* @see #getAttribLocation
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public int glGetAttribLocation(GL2ES2 gl, String name) {
if(!shaderProgram.linked()) throw new GLException("Program is not linked");
@@ -240,17 +237,17 @@ public class ShaderState {
* Even if the attribute is not found in the current shader,
* it is stored in this state.
*
- * @returns false, if the name is not found, otherwise true
+ * @return false, if the name is not found, otherwise true
*
* @throws GLException if the program is not in use
*
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
- * @see #getVertexAttributePointer
+ * @see #getVertexAttribPointer
* @see #glReleaseAllVertexAttributes
* @see #glResetAllVertexAttributes
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public boolean glEnableVertexAttribArray(GL2ES2 gl, String name) {
if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
@@ -281,17 +278,17 @@ public class ShaderState {
* Even if the attribute is not found in the current shader,
* it is removed from this state.
*
- * @returns false, if the name is not found, otherwise true
+ * @return false, if the name is not found, otherwise true
*
* @throws GLException if the program is not in use
*
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
- * @see #getVertexAttributePointer
+ * @see #getVertexAttribPointer
* @see #glReleaseAllVertexAttributes
* @see #glResetAllVertexAttributes
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public boolean glDisableVertexAttribArray(GL2ES2 gl, String name) {
if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
@@ -322,17 +319,17 @@ public class ShaderState {
* it's index will be set with the attribute's location,
* if found.
*
- * @returns false, if the name is not found, otherwise true
+ * @return false, if the name is not found, otherwise true
*
* @throws GLException if the program is not in use
*
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
- * @see #getVertexAttributePointer
+ * @see #getVertexAttribPointer
* @see #glReleaseAllVertexAttributes
* @see #glResetAllVertexAttributes
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public boolean glVertexAttribPointer(GL2ES2 gl, GLArrayData data) {
if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
@@ -367,15 +364,15 @@ public class ShaderState {
/**
* Get the vertex attribute data, previously set.
*
- * @returns the GLArrayData object, null if not previously set.
+ * @return the GLArrayData object, null if not previously set.
*
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
- * @see #getVertexAttributePointer
+ * @see #getVertexAttribPointer
* @see #glReleaseAllVertexAttributes
* @see #glResetAllVertexAttributes
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public GLArrayData getVertexAttribPointer(String name) {
return (GLArrayData) vertexAttribMap2Data.get(name);
@@ -390,11 +387,11 @@ public class ShaderState {
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
- * @see #getVertexAttributePointer
+ * @see #getVertexAttribPointer
* @see #glReleaseAllVertexAttributes
* @see #glResetAllVertexAttributes
* @see #glResetAllVertexAttributes
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public void glReleaseAllVertexAttributes(GL2ES2 gl) {
if(null!=shaderProgram) {
@@ -428,11 +425,11 @@ public class ShaderState {
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
- * @see #getVertexAttributePointer
+ * @see #getVertexAttribPointer
* @see #glReleaseAllVertexAttributes
* @see #glResetAllVertexAttributes
* @see #glResetAllVertexAttributes
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public void glDisableAllVertexAttributeArrays(GL2ES2 gl, boolean removeFromState) {
if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
@@ -458,10 +455,10 @@ public class ShaderState {
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
- * @see #getVertexAttributePointer
+ * @see #getVertexAttribPointer
* @see #glReleaseAllVertexAttributes
* @see #glResetAllVertexAttributes
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public void glResetAllVertexAttributes(GL2ES2 gl) {
if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
@@ -520,7 +517,7 @@ public class ShaderState {
* @see #glGetUniformLocation
* @see javax.media.opengl.GL2ES2#glGetUniformLocation
* @see #getUniformLocation
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
protected int glGetUniformLocation(GL2ES2 gl, String name) {
if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
@@ -554,14 +551,14 @@ public class ShaderState {
* if found.
*
*
- * @returns false, if the name is not found, otherwise true
+ * @return false, if the name is not found, otherwise true
*
* @throws GLException if the program is not in use
*
* @see #glGetUniformLocation
* @see javax.media.opengl.GL2ES2#glGetUniformLocation
* @see #getUniformLocation
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public boolean glUniform(GL2ES2 gl, GLUniformData data) {
if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
@@ -581,7 +578,7 @@ public class ShaderState {
/**
* Get the uniform data, previously set.
*
- * @returns the GLUniformData object, null if not previously set.
+ * @return the GLUniformData object, null if not previously set.
*/
public GLUniformData getUniform(String name) {
return (GLUniformData) uniformMap2Data.get(name);
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
index a7042c47a..f00357bfb 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
@@ -66,25 +66,25 @@ public class FixedFuncUtil {
/**
* String name for
- * @see javax.media.opengl.GL#GL_VERTEX_ARRAY
+ * @see javax.media.opengl.GL2#GL_VERTEX_ARRAY
*/
public static final String mgl_Vertex = FixedFuncPipeline.mgl_Vertex;
/**
* String name for
- * @see javax.media.opengl.GL#GL_NORMAL_ARRAY
+ * @see javax.media.opengl.GL2#GL_NORMAL_ARRAY
*/
public static final String mgl_Normal = FixedFuncPipeline.mgl_Normal;
/**
* String name for
- * @see javax.media.opengl.GL#GL_COLOR_ARRAY
+ * @see javax.media.opengl.GL2#GL_COLOR_ARRAY
*/
public static final String mgl_Color = FixedFuncPipeline.mgl_Color;
/**
* String name for
- * @see javax.media.opengl.GL#GL_TEXTURE_COORD_ARRAY
+ * @see javax.media.opengl.GL2#GL_TEXTURE_COORD_ARRAY
*/
public static final String mgl_MultiTexCoord = FixedFuncPipeline.mgl_MultiTexCoord;
}
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..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.newFloatBuffer(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.newFloatBuffer(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.newFloatBuffer(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.newFloatBuffer(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.newFloatBuffer(params, params_offset));
+ glMaterialfv(face, pname, GLBuffers.newDirectFloatBuffer(params, params_offset));
}
public void glMaterialf(int face, int pname, float param) {
- glMaterialfv(face, pname, BufferUtil.newFloatBuffer(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/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";
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java
index 9741da737..a0eed50ea 100755
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java
@@ -7,16 +7,17 @@ import com.jogamp.opengl.util.glsl.*;
import java.io.*;
import java.net.*;
-/** Precompiles a shader into a vendor binary format. Input is the
- resource name of the shader, such as
- "com/jogamp/opengl/impl/glsl/fixed/shader/a.fp".
- Output is "com/jogamp/opengl/impl/glsl/fixed/shader/bin/nvidia/a.bfp".
-
- All path and suffixes are determined by the ShaderCode class,
- which ensures runtime compatibility.
-
- @see javax.media.opengl.glsl.ShaderCode
- */
+/**
+ * Precompiles a shader into a vendor binary format. Input is the
+ * resource name of the shader, such as
+ * "com/jogamp/opengl/impl/glsl/fixed/shader/a.fp".
+ * Output is "com/jogamp/opengl/impl/glsl/fixed/shader/bin/nvidia/a.bfp".
+ *
+ * All path and suffixes are determined by the ShaderCode class,
+ * which ensures runtime compatibility.
+ *
+ * @see com.jogamp.opengl.util.glsl.ShaderCode
+ */
public abstract class CompileShader {
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 4feeb9f4e..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.newByteBuffer(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 b1f18cc9e..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.newByteBuffer(size);
+ return GLBuffers.newDirectByteBuffer(size);
}
public void debugPrint() {
diff --git a/src/jogl/classes/javax/media/opengl/GLArrayData.java b/src/jogl/classes/javax/media/opengl/GLArrayData.java
index d17ee6a06..088c71bd8 100644
--- a/src/jogl/classes/javax/media/opengl/GLArrayData.java
+++ b/src/jogl/classes/javax/media/opengl/GLArrayData.java
@@ -21,10 +21,10 @@ public interface GLArrayData {
* The index of the predefined array index, see list below,
* or -1 in case of a shader attribute array.
*
- * @see javax.media.opengl.GL#GL_VERTEX_ARRAY
- * @see javax.media.opengl.GL#GL_NORMAL_ARRAY
- * @see javax.media.opengl.GL#GL_COLOR_ARRAY
- * @see javax.media.opengl.GL#GL_TEXTURE_COORD_ARRAY
+ * @see javax.media.opengl.GL2#GL_VERTEX_ARRAY
+ * @see javax.media.opengl.GL2#GL_NORMAL_ARRAY
+ * @see javax.media.opengl.GL2#GL_COLOR_ARRAY
+ * @see javax.media.opengl.GL2#GL_TEXTURE_COORD_ARRAY
*/
public int getIndex();
@@ -49,7 +49,7 @@ public interface GLArrayData {
* Sets the determined location of the shader attribute
* This is usually done within ShaderState.
*
- * @see javax.media.opengl.glsl.ShaderState#glVertexAttribPointer(GL2ES2, GLArrayData)
+ * @see com.jogamp.opengl.util.glsl.ShaderState#glVertexAttribPointer(GL2ES2, GLArrayData)
*/
public void setLocation(int v);
diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java
index be5a6dc4f..369907c22 100644
--- a/src/jogl/classes/javax/media/opengl/GLBase.java
+++ b/src/jogl/classes/javax/media/opengl/GLBase.java
@@ -220,7 +220,7 @@ public interface GLBase {
*
* @param glFunctionName the name of the OpenGL function (e.g., use
* "glBindRenderbufferEXT" or "glBindRenderbuffer" to check if {@link
- * #glBindRenderbuffer(int,int)} is available).
+ * GL#glBindRenderbuffer(int,int)} is available).
*/
public boolean isFunctionAvailable(String glFunctionName);
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 3ca1cd317..1e52c2a65 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -137,14 +137,14 @@ public abstract class GLContext {
* copied. <code>mask</code> contains the bitwise OR of the same
* symbolic names that are passed to the GL command {@link
* GL#glPushAttrib glPushAttrib}. The single symbolic constant
- * {@link GL#GL_ALL_ATTRIB_BITS GL_ALL_ATTRIB_BITS} can be used to
+ * {@link GL2#GL_ALL_ATTRIB_BITS GL_ALL_ATTRIB_BITS} can be used to
* copy the maximum possible portion of rendering state. <P>
*
* Not all values for GL state can be copied. For example, pixel
* pack and unpack state, render mode state, and select and feedback
* state are not copied. The state that can be copied is exactly the
* state that is manipulated by the GL command {@link
- * GL#glPushAttrib glPushAttrib}. <P>
+ * GL2#glPushAttrib glPushAttrib}. <P>
*
* On most platforms, this context may not be current to any thread,
* including the calling thread, when this method is called. Some
@@ -165,7 +165,7 @@ public abstract class GLContext {
* If no context is current, throw an GLException
*
* @return the current context's GL object on this thread
- * @thows GLException if no context is current
+ * @throws GLException if no context is current
*/
public static GL getCurrentGL() throws GLException {
GLContext glc = getCurrent();
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index 58a0fabbc..d61ceb1f4 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -186,10 +186,10 @@ public abstract class GLDrawableFactory {
* The native platform's chosen Capabilties are referenced within the target
* NativeWindow's AbstractGraphicsConfiguration.<p>
*
- * In case {@link javax.media.nativewindow.Capabilties#isOnscreen()} is true,<br>
+ * In case {@link javax.media.nativewindow.Capabilities#isOnscreen()} is true,<br>
* an onscreen GLDrawable will be realized.
* <p>
- * In case {@link javax.media.nativewindow.Capabilties#isOnscreen()} is false,<br>
+ * In case {@link javax.media.nativewindow.Capabilities#isOnscreen()} is false,<br>
* either a Pbuffer drawable is created if {@link javax.media.opengl.GLCapabilities#isPBuffer()} is true,<br>
* or a simple offscreen drawable is creates. The latter is unlikely to be hardware accelerated.<br>
* <p>
diff --git a/src/jogl/classes/javax/media/opengl/GLUniformData.java b/src/jogl/classes/javax/media/opengl/GLUniformData.java
index f628ce35a..9b0d5f151 100644
--- a/src/jogl/classes/javax/media/opengl/GLUniformData.java
+++ b/src/jogl/classes/javax/media/opengl/GLUniformData.java
@@ -10,7 +10,6 @@ public class GLUniformData {
*
* Number of objects is 1
*
- * @param components number of elements of one object, ie 4 for GL_FLOAT_VEC4,
*/
public GLUniformData(String name, int val) {
init(name, 1, new Integer(val));
@@ -21,7 +20,6 @@ public class GLUniformData {
*
* Number of objects is 1
*
- * @param components number of elements of one object, ie 4 for GL_FLOAT_VEC4,
*/
public GLUniformData(String name, float val) {
init(name, 1, new Float(val));
diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java b/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java
index 61757abde..b899f3c0a 100644
--- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java
+++ b/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java
@@ -6,8 +6,6 @@ package javax.media.opengl.fixedfunc;
import java.nio.*;
-import javax.media.opengl.*;
-
public interface GLMatrixFunc {
public static final int GL_MATRIX_MODE = 0x0BA0;
@@ -56,7 +54,7 @@ public interface GLMatrixFunc {
/**
* glMultMatrixf
- * @param params the FloatBuffer's position remains unchanged,
+ * @param m the FloatBuffer's position remains unchanged,
* which is the same behavior than the native JOGL GL impl
*/
public void glMultMatrixf(java.nio.FloatBuffer m) ;