paint background when clearing

This commit is contained in:
Konstantin Käfer
2014-06-24 16:47:55 +02:00
parent 7637b7f8c7
commit eb84492556
2 changed files with 6 additions and 11 deletions

View File

@@ -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<StyleLayer> background_layer = map.getStyle()->background;
const BackgroundProperties &properties = background_layer ? background_layer->getProperties<BackgroundProperties>() : defaultStyleProperties<BackgroundProperties>();
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() {

View File

@@ -12,14 +12,10 @@ void Painter::drawClippingMasks(const std::set<std::shared_ptr<Source>> &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<StyleLayer> background_layer = map.getStyle()->background;
// const BackgroundProperties &properties = background_layer ? background_layer->getProperties<BackgroundProperties>() : defaultStyleProperties<BackgroundProperties>();
const BackgroundProperties &properties = defaultStyleProperties<BackgroundProperties>();
plainShader->setColor(properties.color);
coveringPlainArray.bind(*plainShader, tileStencilBuffer, BUFFER_OFFSET(0));
for (const std::shared_ptr<Source> &source : sources) {
@@ -27,6 +23,7 @@ void Painter::drawClippingMasks(const std::set<std::shared_ptr<Source>> &sources
}
glEnable(GL_DEPTH_TEST);
glColorMask(true, true, true, true);
depthMask(true);
glStencilMask(0x0);
}