use of java.nio.ByteBuffer in project titan by thinkaurelius.
the class BufferUtil method getLongBuffer.
public static final StaticBuffer getLongBuffer(long id) {
ByteBuffer buffer = ByteBuffer.allocate(longSize);
buffer.putLong(id);
byte[] arr = buffer.array();
Preconditions.checkArgument(arr.length == longSize);
return StaticArrayBuffer.of(arr);
}
use of java.nio.ByteBuffer in project titan by thinkaurelius.
the class BufferUtil method getIntBuffer.
public static final StaticBuffer getIntBuffer(int[] ids) {
ByteBuffer buffer = ByteBuffer.allocate(intSize * ids.length);
for (int i = 0; i < ids.length; i++) buffer.putInt(ids[i]);
byte[] arr = buffer.array();
Preconditions.checkArgument(arr.length == intSize * ids.length);
return StaticArrayBuffer.of(arr);
}
use of java.nio.ByteBuffer in project playn by threerings.
the class JavaGL20 method glGetShaderInfoLog.
@Override
public String glGetShaderInfoLog(int shader) {
ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 10);
buffer.order(ByteOrder.nativeOrder());
ByteBuffer tmp = ByteBuffer.allocateDirect(4);
tmp.order(ByteOrder.nativeOrder());
IntBuffer intBuffer = tmp.asIntBuffer();
GL20.glGetShaderInfoLog(shader, intBuffer, buffer);
int numBytes = intBuffer.get(0);
byte[] bytes = new byte[numBytes];
buffer.get(bytes);
return new String(bytes);
}
use of java.nio.ByteBuffer in project playn by threerings.
the class JavaGL20 method glTexSubImage3D.
@Override
public void glTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, int pixels) {
final ByteBuffer byteBuffer = BufferUtils.createByteBuffer(1);
byteBuffer.putInt(pixels);
byteBuffer.rewind();
GL12.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, byteBuffer);
}
use of java.nio.ByteBuffer in project playn by threerings.
the class RoboGL20 method glGetShaderInfoLog.
public String glGetShaderInfoLog(int shader) {
ByteBuffer bbuf = bufs.createByteBuffer(MAX_LOG_SIZE);
glGetShaderInfoLog(shader, MAX_LOG_SIZE, bufs.intBuffer, bbuf);
return toString(bbuf, bufs.intBuffer.get(0));
}
Aggregations