Methods Summary |
---|
public static native void | _getBytes(int address, byte[] dst, int offset, int length)
|
public static void | getBytes(java.nio.Buffer buf, int boffset, byte[] dst, int offset, int length)
int address = GL10Impl._getNativeAddress(buf, 0);
int capacity = buf.capacity();
if (buf instanceof ByteBuffer) {
ByteBuffer bbi = (ByteBuffer)buf;
if (!bbi.isDirect()) {
throw new IllegalArgumentException("!isDirect");
}
} else if (buf instanceof ShortBuffer) {
ShortBuffer sbi = (ShortBuffer)buf;
if (!sbi.isDirect()) {
throw new IllegalArgumentException("!isDirect");
}
capacity *= 2;
} else if (buf instanceof IntBuffer) {
IntBuffer ibi = (IntBuffer)buf;
if (!ibi.isDirect()) {
throw new IllegalArgumentException("!isDirect");
}
capacity *= 4;
} else if (buf instanceof FloatBuffer) {
FloatBuffer fbi = (FloatBuffer)buf;
if (!fbi.isDirect()) {
throw new IllegalArgumentException("!isDirect");
}
capacity *= 4;
} else {
throw new IllegalArgumentException("Unknown buffer type!");
}
if (boffset < 0 || boffset + length > capacity) {
throw new IllegalArgumentException("boffset out of bounds");
}
if (offset < 0 || offset + length > dst.length) {
throw new IllegalArgumentException("offset out of bounds");
}
_getBytes(address + boffset, dst, offset, length);
|
public static synchronized void | newBuffer(java.nio.Buffer b, int pointer)
// Record the native address of this buffer along with a
// weak reference.
bufferWeakReferences.put(new WeakReference(b), new Integer(pointer));
|
public static synchronized void | releaseBuffer(java.nio.Buffer b)
if (b == null) {
return;
}
Object o = bufferStrongReferences.get(b);
int refs = (o == null) ? 0 : ((Integer)o).intValue();
if (refs > 1) {
bufferStrongReferences.put(b, new Integer(refs - 1));
} else {
bufferStrongReferences.remove(b);
}
|
public static synchronized void | useBuffer(java.nio.Buffer b)
if (b == null) {
return;
}
Object o = bufferStrongReferences.get(b);
int refs = (o == null) ? 0 : ((Integer)o).intValue();
bufferStrongReferences.put(b, new Integer(refs + 1));
|