check gl errors, cleanups

This commit is contained in:
Hannes Janetzek 2013-02-24 11:22:40 +01:00
parent 00f1fe9438
commit b328d769a5

View File

@ -147,8 +147,6 @@ public class LineTexRenderer {
GLES20.glUniformMatrix4fv(hMatrix, 1, false, matrix, 0); GLES20.glUniformMatrix4fv(hMatrix, 1, false, matrix, 0);
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER,
mIndicesBufferID); mIndicesBufferID);
@ -174,12 +172,10 @@ public class LineTexRenderer {
GLES20.glUniform4fv(hBgColor, 1, line.color, 0); GLES20.glUniform4fv(hBgColor, 1, line.color, 0);
//GLES20.glUniform4f(hBgColor, 0x99 / 255f, 0x96 / 255f, 0x93 / 255f, 0.95f);
// scale pattern to twice its size, then reset scale to 1. // scale pattern to twice its size, then reset scale to 1.
// (coord scale * pattern size / tex size) / scale // (coord scale * pattern size / tex size) / scale
//GLES20.glUniform1f(hPatternScale, (8 * line.stipple / 64) / Math.max((int) s, 1)); //GLES20.glUniform1f(hPatternScale, (8 * line.stipple / 64) / Math.max((int) s, 1));
float ps = FastMath.clamp((int) (s * 1.3f), 1, 4); float ps = FastMath.clamp((int) (s * 1.3f), 1, 3);
GLES20.glUniform1f(hPatternScale, (8 * line.stipple) / ps); GLES20.glUniform1f(hPatternScale, (8 * line.stipple) / ps);
GLES20.glUniform1f(hPatternWidth, line.stippleWidth); GLES20.glUniform1f(hPatternWidth, line.stippleWidth);
@ -189,6 +185,8 @@ public class LineTexRenderer {
GLES20.glUniform1f(hScale, pos.scale); GLES20.glUniform1f(hScale, pos.scale);
GLES20.glUniform1f(hWidth, ll.width / s * COORD_SCALE_BY_DIR_SCALE); GLES20.glUniform1f(hWidth, ll.width / s * COORD_SCALE_BY_DIR_SCALE);
GlUtils.checkGlError("0");
// add offset vertex // add offset vertex
int vOffset = -STRIDE; int vOffset = -STRIDE;
@ -222,6 +220,8 @@ public class LineTexRenderer {
GLES20.GL_UNSIGNED_SHORT, 0); GLES20.GL_UNSIGNED_SHORT, 0);
} }
GlUtils.checkGlError("1");
// second pass // second pass
allIndices = (ll.oddQuads * 6); allIndices = (ll.oddQuads * 6);
for (int i = 0; i < allIndices; i += maxIndices) { for (int i = 0; i < allIndices; i += maxIndices) {
@ -252,6 +252,8 @@ public class LineTexRenderer {
} }
l = l.next; l = l.next;
GlUtils.checkGlError("2");
} }
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0); GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0);
@ -261,7 +263,7 @@ public class LineTexRenderer {
GLES20.glDisableVertexAttribArray(hVertexLength0); GLES20.glDisableVertexAttribArray(hVertexLength0);
GLES20.glDisableVertexAttribArray(hVertexLength1); GLES20.glDisableVertexAttribArray(hVertexLength1);
GLES20.glDisableVertexAttribArray(hVertexFlip); GLES20.glDisableVertexAttribArray(hVertexFlip);
GlUtils.checkGlError(TAG); GlUtils.checkGlError("end");
//GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0); //GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);