aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-10-16 08:09:56 +0200
committerSven Gothel <[email protected]>2012-10-16 08:09:56 +0200
commit7dd4975020e6c255f2f0b02cff6c8d4c1b72a4dc (patch)
tree2219663348ab0ae566779933ec78edffd79a37bd
parent4c3f7ca00fe1d90787645423aab56338a3549904 (diff)
JoglGL2ES1: ImmModeSink: Drop color components (not used), initialElementSize == 4 (max in jake2, save memory); DrawElements w/ indices: Add GL_QUADS case
-rw-r--r--src/jake2/render/opengl/JoglGL2ES1.java14
1 files changed, 11 insertions, 3 deletions
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) {