From 7dd4975020e6c255f2f0b02cff6c8d4c1b72a4dc Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 16 Oct 2012 08:09:56 +0200 Subject: JoglGL2ES1: ImmModeSink: Drop color components (not used), initialElementSize == 4 (max in jake2, save memory); DrawElements w/ indices: Add GL_QUADS case --- src/jake2/render/opengl/JoglGL2ES1.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/jake2/render/opengl') diff --git a/src/jake2/render/opengl/JoglGL2ES1.java b/src/jake2/render/opengl/JoglGL2ES1.java index e03a863..94decb2 100644 --- a/src/jake2/render/opengl/JoglGL2ES1.java +++ b/src/jake2/render/opengl/JoglGL2ES1.java @@ -15,9 +15,9 @@ public class JoglGL2ES1 implements QGL { JoglGL2ES1() { // singleton - ims = ImmModeSink.createFixed(4*8, + ims = ImmModeSink.createFixed(4, 3, GL.GL_FLOAT, // vertex - 4, GL.GL_FLOAT, // color + 0, 0, // color 0, 0, // normal 2, GL.GL_FLOAT, // texture GL.GL_STATIC_DRAW); @@ -181,7 +181,15 @@ public class JoglGL2ES1 implements QGL { mode=GL.GL_TRIANGLE_FAN; break; } - gl.glDrawElements(mode, indices.limit(), GL_UNSIGNED_INT, indices); + final int idxLen = indices.remaining(); + if ( GL_QUADS == mode && !gl.isGL2() ) { + final int idx0 = indices.position(); + for (int j = 0; j < idxLen; j++) { + gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0xffffffff & indices.get(idx0+j)), 4); + } + } else { + gl.glDrawElements(mode, idxLen, GL_UNSIGNED_INT, indices); + } } public void glEnable(int cap) { -- cgit v1.2.3