clear stencil after each tile
This commit is contained in:
parent
2b68d93891
commit
f442395a11
@ -16,6 +16,7 @@ package org.oscim.renderer;
|
||||
|
||||
import static android.opengl.GLES20.GL_ARRAY_BUFFER;
|
||||
import static android.opengl.GLES20.GL_BLEND;
|
||||
import static android.opengl.GLES20.glStencilMask;
|
||||
import static org.oscim.generator.JobTile.STATE_READY;
|
||||
|
||||
import org.oscim.core.MapPosition;
|
||||
@ -54,8 +55,9 @@ public class BaseMap {
|
||||
mDrawCnt = 0;
|
||||
|
||||
GLES20.glDepthFunc(GLES20.GL_LESS);
|
||||
|
||||
glStencilMask(0xFF);
|
||||
LineRenderer.beginLines();
|
||||
|
||||
for (int i = 0; i < tileCnt; i++) {
|
||||
MapTile t = tiles[i];
|
||||
if (t.isVisible && t.state == STATE_READY)
|
||||
@ -79,6 +81,7 @@ public class BaseMap {
|
||||
}
|
||||
|
||||
LineRenderer.endLines();
|
||||
glStencilMask(0x0);
|
||||
|
||||
//long end = SystemClock.uptimeMillis();
|
||||
//Log.d(TAG, "base took " + (end - start));
|
||||
@ -144,7 +147,13 @@ public class BaseMap {
|
||||
break;
|
||||
}
|
||||
}
|
||||
PolygonRenderer.drawOver(mvp);
|
||||
|
||||
glStencilMask(0xFF);
|
||||
GLES20.glClear(GLES20.GL_STENCIL_BUFFER_BIT);
|
||||
//glStencilMask(0x0);
|
||||
|
||||
//PolygonRenderer.drawOver(mvp);
|
||||
//GLES20.glFlush();
|
||||
}
|
||||
|
||||
private static int drawProxyChild(MapTile tile, MapPosition pos) {
|
||||
|
@ -243,14 +243,20 @@ public final class PolygonRenderer {
|
||||
return l;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param clip ...
|
||||
* @param first ...
|
||||
*/
|
||||
static void drawStencilRegion(boolean clip, boolean first) {
|
||||
GLState.useProgram(polygonProgram);
|
||||
|
||||
// disable drawing to framebuffer (will be re-enabled in fill)
|
||||
glColorMask(false, false, false, false);
|
||||
|
||||
// write to all bits
|
||||
glStencilMask(0xFF);
|
||||
if (!first) {
|
||||
// write to all bits
|
||||
glStencilMask(0xFF);
|
||||
}
|
||||
|
||||
// set clip bit (0x80) for draw region
|
||||
glStencilOp(GLES20.GL_KEEP, GLES20.GL_KEEP, GLES20.GL_REPLACE);
|
||||
@ -295,6 +301,7 @@ public final class PolygonRenderer {
|
||||
}
|
||||
|
||||
static void drawOver(float[] matrix) {
|
||||
|
||||
GLState.useProgram(polygonProgram);
|
||||
|
||||
GLState.enableVertexArrays(hPolygonVertexPosition, -1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user