use glCullFace GL_FRONT to avoid having to flip triangles

triangle-jni: some loop optimizations
This commit is contained in:
Hannes Janetzek
2013-01-04 21:05:27 +01:00
parent 45b19d6a91
commit 35923938db
3 changed files with 44 additions and 58 deletions

View File

@@ -145,8 +145,8 @@ public class ExtrusionLayer extends Layer {
i = 0;
}
indices[i++] = first;
indices[i++] = (short) (first + k + 4);
indices[i++] = (short) (first + k + 2);
indices[i++] = (short) (first + k + 4);
}
mCurIndices[IND_ROOF].used = i;
}
@@ -316,12 +316,12 @@ public class ExtrusionLayer extends Layer {
}
indices[ind + 0] = s0;
indices[ind + 1] = s1;
indices[ind + 2] = s2;
indices[ind + 1] = s2;
indices[ind + 2] = s1;
indices[ind + 3] = s1;
indices[ind + 4] = s3;
indices[ind + 5] = s2;
indices[ind + 4] = s2;
indices[ind + 5] = s3;
mCurIndices[even].used += 6;
even = (even + 1) % 2;

View File

@@ -184,6 +184,7 @@ public class BuildingOverlay2 extends RenderOverlay {
GLRenderer.enableVertexArrays(hBuildingVertexPosition, -1);
GLES20.glEnable(GLES20.GL_CULL_FACE);
GLES20.glCullFace(GLES20.GL_FRONT);
GLES20.glEnable(GLES20.GL_POLYGON_OFFSET_FILL);
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
GLES20.glDepthFunc(GLES20.GL_LESS);