From bf55e843dba2f8808817e756ccce0ea49c4d45b5 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 16 Oct 2012 16:35:59 +0200 Subject: 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) --- src/jake2/util/Lib.java | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/jake2/util/Lib.java') 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); -- cgit v1.2.3