aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/util
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-10-16 16:35:59 +0200
committerSven Gothel <[email protected]>2012-10-16 16:35:59 +0200
commitbf55e843dba2f8808817e756ccce0ea49c4d45b5 (patch)
treeaaea7a8a1256fbc78b9f3040d7f33a572a8c072b /src/jake2/util
parent0e0ab268b810371828f23d9e5f6be46a3c8a081f (diff)
Fix QGL for ES1/ES2: Use ushort indices, since uint is n/a on ES1/ES2 profile
glDrawElements(int mode, IntBuffer indices) -> glDrawElements(int mode, ShortBuffer indices)
Diffstat (limited to 'src/jake2/util')
-rw-r--r--src/jake2/util/Lib.java21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/jake2/util/Lib.java b/src/jake2/util/Lib.java
index 37ab5c8..173d998 100644
--- a/src/jake2/util/Lib.java
+++ b/src/jake2/util/Lib.java
@@ -353,6 +353,7 @@ public class Lib {
public static final int SIZEOF_FLOAT = 4;
public static final int SIZEOF_INT = 4;
+ public static final int SIZEOF_SHORT = 2;
public static FloatBuffer newFloatBuffer(int numElements) {
ByteBuffer bb = newByteBuffer(numElements * SIZEOF_FLOAT);
@@ -362,13 +363,21 @@ public class Lib {
ByteBuffer bb = newByteBuffer(numElements * SIZEOF_FLOAT, order);
return bb.asFloatBuffer();
}
- public static IntBuffer newIntBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_INT);
- return bb.asIntBuffer();
+ public static IntBuffer newIntBuffer(int numElements) {
+ ByteBuffer bb = newByteBuffer(numElements * SIZEOF_INT);
+ return bb.asIntBuffer();
+ }
+ public static IntBuffer newIntBuffer(int numElements, ByteOrder order) {
+ ByteBuffer bb = newByteBuffer(numElements * SIZEOF_INT, order);
+ return bb.asIntBuffer();
+ }
+ public static ShortBuffer newShortBuffer(int numElements) {
+ ByteBuffer bb = newByteBuffer(numElements * SIZEOF_SHORT);
+ return bb.asShortBuffer();
}
- public static IntBuffer newIntBuffer(int numElements, ByteOrder order) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_INT, order);
- return bb.asIntBuffer();
+ public static ShortBuffer newShortBuffer(int numElements, ByteOrder order) {
+ ByteBuffer bb = newByteBuffer(numElements * SIZEOF_SHORT, order);
+ return bb.asShortBuffer();
}
public static ByteBuffer newByteBuffer(int numElements) {
ByteBuffer bb = ByteBuffer.allocateDirect(numElements);