Package org.lwjgl
Class BufferUtils
java.lang.Object
org.lwjgl.BufferUtils
Some often-used Buffer code for creating native buffers of the appropriate size.
- Version:
- $Revision$ $Id$
- Author:
- $Author$
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ByteBuffer
createByteBuffer
(int size) Construct a direct native-ordered bytebuffer with the specified size.static CharBuffer
createCharBuffer
(int size) Construct a direct native-order charbuffer with the specified number of elements.static DoubleBuffer
createDoubleBuffer
(int size) Construct a direct native-order doublebuffer with the specified number of elements.static FloatBuffer
createFloatBuffer
(int size) Construct a direct native-order floatbuffer with the specified number of elements.static IntBuffer
createIntBuffer
(int size) Construct a direct native-order intbuffer with the specified number of elements.static LongBuffer
createLongBuffer
(int size) Construct a direct native-order longbuffer with the specified number of elements.static PointerBuffer
createPointerBuffer
(int size) Construct a PointerBuffer with the specified number of elements.static ShortBuffer
createShortBuffer
(int size) Construct a direct native-order shortbuffer with the specified number of elements.static int
static int
A helper function which is used to get the byte offset in an arbitrary buffer based on its positionstatic void
Fill buffer with zeros from position to remainingstatic void
Fill buffer with zeros from position to remainingstatic void
Fill buffer with zeros from position to remainingstatic void
Fill buffer with zeros from position to remainingstatic void
Fill buffer with zeros from position to remainingstatic void
Fill buffer with zeros from position to remainingstatic void
Fill buffer with zeros from position to remaining
-
Constructor Details
-
BufferUtils
public BufferUtils()
-
-
Method Details
-
createByteBuffer
Construct a direct native-ordered bytebuffer with the specified size.- Parameters:
size
- The size, in bytes- Returns:
- a ByteBuffer
-
createShortBuffer
Construct a direct native-order shortbuffer with the specified number of elements.- Parameters:
size
- The size, in shorts- Returns:
- a ShortBuffer
-
createCharBuffer
Construct a direct native-order charbuffer with the specified number of elements.- Parameters:
size
- The size, in chars- Returns:
- an CharBuffer
-
createIntBuffer
Construct a direct native-order intbuffer with the specified number of elements.- Parameters:
size
- The size, in ints- Returns:
- an IntBuffer
-
createLongBuffer
Construct a direct native-order longbuffer with the specified number of elements.- Parameters:
size
- The size, in longs- Returns:
- an LongBuffer
-
createFloatBuffer
Construct a direct native-order floatbuffer with the specified number of elements.- Parameters:
size
- The size, in floats- Returns:
- a FloatBuffer
-
createDoubleBuffer
Construct a direct native-order doublebuffer with the specified number of elements.- Parameters:
size
- The size, in floats- Returns:
- a FloatBuffer
-
createPointerBuffer
Construct a PointerBuffer with the specified number of elements.- Parameters:
size
- The size, in memory addresses- Returns:
- a PointerBuffer
-
getElementSizeExponent
- Returns:
- n, where buffer_element_size=2^n.
-
getOffset
A helper function which is used to get the byte offset in an arbitrary buffer based on its position- Returns:
- the position of the buffer, in BYTES
-
zeroBuffer
Fill buffer with zeros from position to remaining -
zeroBuffer
Fill buffer with zeros from position to remaining -
zeroBuffer
Fill buffer with zeros from position to remaining -
zeroBuffer
Fill buffer with zeros from position to remaining -
zeroBuffer
Fill buffer with zeros from position to remaining -
zeroBuffer
Fill buffer with zeros from position to remaining -
zeroBuffer
Fill buffer with zeros from position to remaining
-