public class MrBuffer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
TARGET_ARRAY_BUFFER
Target type for VBO
|
static int |
TARGET_ELEMENT_ARRAY_BUFFER
Target type for IBO
|
static int |
USAGE_STATIC_DRAW
Usage draw type
|
Constructor and Description |
---|
MrBuffer(int capacity,
MrDataType dataType,
int target,
int usage)
Creates a new buffer
|
Modifier and Type | Method and Description |
---|---|
java.nio.Buffer |
asBuffer()
Returns this buffer as a Java buffer object
|
static MrBuffer |
genIndexBuffer(int capacity)
Creates an IBO with the given capacity
|
static MrBuffer |
genVertexBuffer(int capacity)
Creates a VBO with the given capacity
|
MrDataType |
getBufferDataType()
Gets the data type used in this buffer
|
int |
getBufferSize()
Returns the capacity of this buffer
|
int |
getBufferTarget()
Gets the buffer target
|
int |
getBufferUsage()
Gets the buffer usage
|
int |
getId()
Gets the GPU id of this buffer
|
void |
putByte(java.lang.Byte b)
Puts a byte in this buffer
|
void |
putBytes(byte[] bytes)
Puts a byte array in this buffer
|
void |
putChar(char c)
Puts a char in this buffer
|
void |
putChars(char[] chars)
Puts a char array in this buffer
|
void |
putDouble(double d)
Puts a double in this buffer
|
void |
putDoubles(double[] doubles)
Puts a double array in this buffer
|
void |
putFloat(float f)
Puts a float in this buffer
|
void |
putFloats(float[] floats)
Puts a float array in this buffer
|
void |
putInt(int i)
Puts an integer in this buffer
|
void |
putInts(int[] ints)
Puts an integer array in this buffer
|
void |
putLong(long l)
Puts a long in this buffer
|
void |
putLongs(long[] longs)
Puts a long array in this buffer
|
void |
putShort(short s)
Puts a short in this buffer
|
void |
putShorts(short[] shorts)
Puts a short array in this buffer
|
void |
releaseBuffer()
Removes and releases the data of this buffer
|
void |
setBufferTarget(int bufferTarget)
Sets the buffer target to be used.
|
void |
setBufferUsage(int bufferUsage)
Sets the buffer usage.
|
void |
setId(int id)
Sets the GPU id given to this buffer
|
public static final int TARGET_ARRAY_BUFFER
public static final int TARGET_ELEMENT_ARRAY_BUFFER
public static final int USAGE_STATIC_DRAW
public MrBuffer(int capacity, MrDataType dataType, int target, int usage)
capacity
- capacity of this buffer, required to memory initializationdataType
- Type of data will be stored, usually short or floattarget
- Target type for VBO or IBOusage
- Usage of this buffer, usually it will not change, so STATIC_DRAW is usedpublic static MrBuffer genIndexBuffer(int capacity)
capacity
- public static MrBuffer genVertexBuffer(int capacity)
capacity
- public int getId()
public void setId(int id)
id
- public int getBufferTarget()
public void setBufferTarget(int bufferTarget)
bufferTarget
- public MrDataType getBufferDataType()
public int getBufferUsage()
public void setBufferUsage(int bufferUsage)
bufferUsage
- public int getBufferSize()
public java.nio.Buffer asBuffer()
public void releaseBuffer()
public void putByte(java.lang.Byte b)
b
- public void putChar(char c)
c
- public void putDouble(double d)
d
- public void putFloat(float f)
f
- public void putInt(int i)
i
- public void putLong(long l)
l
- public void putShort(short s)
s
- public void putBytes(byte[] bytes)
bytes
- public void putChars(char[] chars)
chars
- public void putDoubles(double[] doubles)
doubles
- public void putFloats(float[] floats)
floats
- public void putInts(int[] ints)
ints
- public void putLongs(long[] longs)
longs
- public void putShorts(short[] shorts)
shorts
-