From eb84492556901ac6c6a77c141ac5e37dba70a40c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Tue, 24 Jun 2014 16:47:55 +0200 Subject: [PATCH] paint background when clearing --- src/renderer/painter.cpp | 10 ++++------ src/renderer/painter_clipping.cpp | 7 ++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/renderer/painter.cpp b/src/renderer/painter.cpp index 9d11fe108..0739eea32 100644 --- a/src/renderer/painter.cpp +++ b/src/renderer/painter.cpp @@ -135,13 +135,11 @@ void Painter::clear() { gl::group group("clear"); glStencilMask(0xFF); depthMask(true); -#ifdef NVIDIA - // We're painting in a way that allows us to skip clearing the color buffer. - // On Tegra hardware, this is faster. - glClear(GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); -#else + + std::shared_ptr background_layer = map.getStyle()->background; + const BackgroundProperties &properties = background_layer ? background_layer->getProperties() : defaultStyleProperties(); + glClearColor(properties.color[0], properties.color[1], properties.color[2], properties.color[3]); glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); -#endif } void Painter::setOpaque() { diff --git a/src/renderer/painter_clipping.cpp b/src/renderer/painter_clipping.cpp index 18f546664..95e4b727f 100644 --- a/src/renderer/painter_clipping.cpp +++ b/src/renderer/painter_clipping.cpp @@ -12,14 +12,10 @@ void Painter::drawClippingMasks(const std::set> &sources useProgram(plainShader->program); glDisable(GL_DEPTH_TEST); depthMask(false); + glColorMask(false, false, false, false); glDepthRange(1.0f, 1.0f); glStencilMask(0xFF); -// std::shared_ptr background_layer = map.getStyle()->background; -// const BackgroundProperties &properties = background_layer ? background_layer->getProperties() : defaultStyleProperties(); - const BackgroundProperties &properties = defaultStyleProperties(); - plainShader->setColor(properties.color); - coveringPlainArray.bind(*plainShader, tileStencilBuffer, BUFFER_OFFSET(0)); for (const std::shared_ptr &source : sources) { @@ -27,6 +23,7 @@ void Painter::drawClippingMasks(const std::set> &sources } glEnable(GL_DEPTH_TEST); + glColorMask(true, true, true, true); depthMask(true); glStencilMask(0x0); }