diff options
Diffstat (limited to 'src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javase')
-rw-r--r-- | src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javase | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javase b/src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javase index f9f443e13..59d44f04d 100644 --- a/src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javase +++ b/src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javase @@ -75,6 +75,14 @@ public class InternalBufferUtil { return bb.asIntBuffer(); } + /** 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(); + } + /** 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. */ @@ -84,24 +92,6 @@ public class InternalBufferUtil { } //---------------------------------------------------------------------- - // 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; - } - - //---------------------------------------------------------------------- // Copy routines (type-to-ByteBuffer) // @@ -147,6 +137,20 @@ public class InternalBufferUtil { return dest; } + /** 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; + } + //---------------------------------------------------------------------- // Conversion routines // |