summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2015-11-06 19:55:37 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2015-11-06 20:05:01 +0200
commit5ef5d0886731a800128e5200b4f5bb45708d2b27 (patch)
tree8d6aad1ffb284ca04d477ea4b7725a2283a75757 /src
parent8894982625e732e62a4a12fabd7928800c7d5ded (diff)
downloadqtlocation-mapboxgl-5ef5d0886731a800128e5200b4f5bb45708d2b27.tar.gz
[core] Reset GL values when needed
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/renderer/painter.cpp5
-rw-r--r--src/mbgl/renderer/painter_clipping.cpp2
-rw-r--r--src/mbgl/renderer/painter_debug.cpp2
-rw-r--r--src/mbgl/renderer/painter_fill.cpp2
-rw-r--r--src/mbgl/renderer/painter_line.cpp2
-rw-r--r--src/mbgl/renderer/painter_raster.cpp2
-rw-r--r--src/mbgl/renderer/painter_symbol.cpp16
7 files changed, 29 insertions, 2 deletions
diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp
index 20ebcd5c1b..4cf8626c60 100644
--- a/src/mbgl/renderer/painter.cpp
+++ b/src/mbgl/renderer/painter.cpp
@@ -110,11 +110,14 @@ void Painter::changeMatrix() {
void Painter::clear() {
MBGL_DEBUG_GROUP("clear");
+ config.stencilFunc.reset();
config.stencilTest = GL_TRUE;
config.stencilMask = 0xFF;
config.depthTest = GL_FALSE;
config.depthMask = GL_TRUE;
config.clearColor = { background[0], background[1], background[2], background[3] };
+ config.clearStencil = 0;
+ config.clearDepth = 1;
MBGL_CHECK_ERROR(glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
}
@@ -243,6 +246,7 @@ void Painter::renderPass(RenderPass pass_,
}
if (pass == RenderPass::Translucent) {
+ config.blendFunc.reset();
config.blend = GL_TRUE;
} else {
config.blend = GL_FALSE;
@@ -403,6 +407,7 @@ void Painter::renderBackground(const BackgroundLayer& layer) {
}
config.stencilTest = GL_FALSE;
+ config.depthFunc.reset();
config.depthTest = GL_TRUE;
config.depthRange = { 1.0f, 1.0f };
diff --git a/src/mbgl/renderer/painter_clipping.cpp b/src/mbgl/renderer/painter_clipping.cpp
index 8f6ed75754..4ac3271dd6 100644
--- a/src/mbgl/renderer/painter_clipping.cpp
+++ b/src/mbgl/renderer/painter_clipping.cpp
@@ -10,7 +10,9 @@ void Painter::drawClippingMasks(const std::set<Source*>& sources) {
MBGL_DEBUG_GROUP("clipping masks");
config.program = plainShader->program;
+ config.stencilOp.reset();
config.stencilTest = GL_TRUE;
+ config.depthFunc.reset();
config.depthTest = GL_TRUE;
config.depthMask = GL_FALSE;
config.colorMask = { GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE };
diff --git a/src/mbgl/renderer/painter_debug.cpp b/src/mbgl/renderer/painter_debug.cpp
index 8a12e5df01..b981dae260 100644
--- a/src/mbgl/renderer/painter_debug.cpp
+++ b/src/mbgl/renderer/painter_debug.cpp
@@ -47,6 +47,7 @@ void Painter::renderDebugText(TileData& tileData, const mat4 &matrix) {
config.lineWidth = 2.0f * data.pixelRatio;
tileData.debugBucket->drawLines(*plainShader);
+ config.depthFunc.reset();
config.depthTest = GL_TRUE;
}
@@ -57,6 +58,7 @@ void Painter::renderDebugFrame(const mat4 &matrix) {
// but *don't* disable stencil test, as we want to clip the red tile border
// to the tile viewport.
config.depthTest = GL_FALSE;
+ config.stencilOp.reset();
config.stencilTest = GL_TRUE;
config.program = plainShader->program;
diff --git a/src/mbgl/renderer/painter_fill.cpp b/src/mbgl/renderer/painter_fill.cpp
index b9a0f013e5..e0e1c0c96a 100644
--- a/src/mbgl/renderer/painter_fill.cpp
+++ b/src/mbgl/renderer/painter_fill.cpp
@@ -36,7 +36,9 @@ void Painter::renderFill(FillBucket& bucket, const FillLayer& layer, const TileI
bool outline = properties.antialias && !pattern && stroke_color != fill_color;
bool fringeline = properties.antialias && !pattern && stroke_color == fill_color;
+ config.stencilOp.reset();
config.stencilTest = GL_TRUE;
+ config.depthFunc.reset();
config.depthTest = GL_TRUE;
// Because we're drawing top-to-bottom, and we update the stencil mask
diff --git a/src/mbgl/renderer/painter_line.cpp b/src/mbgl/renderer/painter_line.cpp
index 8eaf6e4e8b..1cdb5e2195 100644
--- a/src/mbgl/renderer/painter_line.cpp
+++ b/src/mbgl/renderer/painter_line.cpp
@@ -17,7 +17,9 @@ void Painter::renderLine(LineBucket& bucket, const LineLayer& layer, const TileI
// Abort early.
if (pass == RenderPass::Opaque) return;
+ config.stencilOp.reset();
config.stencilTest = GL_TRUE;
+ config.depthFunc.reset();
config.depthTest = GL_TRUE;
config.depthMask = GL_FALSE;
diff --git a/src/mbgl/renderer/painter_raster.cpp b/src/mbgl/renderer/painter_raster.cpp
index 7a1c600466..06e6b06c2e 100644
--- a/src/mbgl/renderer/painter_raster.cpp
+++ b/src/mbgl/renderer/painter_raster.cpp
@@ -22,7 +22,9 @@ void Painter::renderRaster(RasterBucket& bucket, const RasterLayer& layer, const
rasterShader->u_contrast_factor = contrastFactor(properties.contrast);
rasterShader->u_spin_weights = spinWeights(properties.hue_rotate);
+ config.stencilOp.reset();
config.stencilTest = GL_TRUE;
+ config.depthFunc.reset();
config.depthTest = GL_TRUE;
setDepthSublayer(0);
bucket.drawRaster(*rasterShader, tileStencilBuffer, coveringRasterArray);
diff --git a/src/mbgl/renderer/painter_symbol.cpp b/src/mbgl/renderer/painter_symbol.cpp
index 2a8e0fdcc3..496b9ee9cc 100644
--- a/src/mbgl/renderer/painter_symbol.cpp
+++ b/src/mbgl/renderer/painter_symbol.cpp
@@ -144,6 +144,7 @@ void Painter::renderSymbol(SymbolBucket& bucket, const SymbolLayer& layer, const
config.depthMask = GL_FALSE;
if (bucket.hasCollisionBoxData()) {
+ config.stencilOp.reset();
config.stencilTest = GL_TRUE;
config.program = collisionBoxShader->program;
@@ -170,11 +171,17 @@ void Painter::renderSymbol(SymbolBucket& bucket, const SymbolLayer& layer, const
if (drawAcrossEdges) {
config.stencilTest = GL_FALSE;
} else {
+ config.stencilOp.reset();
config.stencilTest = GL_TRUE;
}
if (bucket.hasIconData()) {
- config.depthTest = layout.icon.rotation_alignment == RotationAlignmentType::Map;
+ if (layout.icon.rotation_alignment == RotationAlignmentType::Map) {
+ config.depthFunc.reset();
+ config.depthTest = GL_TRUE;
+ } else {
+ config.depthTest = GL_FALSE;
+ }
bool sdf = bucket.sdfIcons;
@@ -246,7 +253,12 @@ void Painter::renderSymbol(SymbolBucket& bucket, const SymbolLayer& layer, const
}
if (bucket.hasTextData()) {
- config.depthTest = layout.text.rotation_alignment == RotationAlignmentType::Map;
+ if (layout.text.rotation_alignment == RotationAlignmentType::Map) {
+ config.depthFunc.reset();
+ config.depthTest = GL_TRUE;
+ } else {
+ config.depthTest = GL_FALSE;
+ }
glyphAtlas->bind();