diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-01-23 10:00:52 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-01-23 10:00:52 +0100 |
commit | 476b7cfdaeadb5153445776f889be5dac17691df (patch) | |
tree | c233107c389c493b0ba0badb1a2381846e6dc638 /src | |
parent | 1ad5970a0001b9dd7ca0bd521b361f0f15c65d0d (diff) | |
download | qtlocation-mapboxgl-476b7cfdaeadb5153445776f889be5dac17691df.tar.gz |
enable antialiasing
Diffstat (limited to 'src')
-rw-r--r-- | src/renderer/painter.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/src/renderer/painter.cpp b/src/renderer/painter.cpp index af5ecb55dd..205258600c 100644 --- a/src/renderer/painter.cpp +++ b/src/renderer/painter.cpp @@ -240,36 +240,36 @@ void Painter::render(const Tile::Ptr& tile) { glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); glStencilMask(0x0); - // // Because we're drawing top-to-bottom, and we update the stencil mask - // // below, we have to draw the outline first (!) - // if (antialiasing) { - - // // if (layerStyle.stroke) { - // // // If we defined a different color for the fill outline, we are - // // // going to ignore the bits in 0x3F and just care about the global - // // // clipping mask. - // // glStencilFunc(GL_EQUAL, 0x80, 0x80); - // // } else { - // // Otherwise, we only want to draw the antialiased parts that are - // // *outside* the current shape. This is important in case the fill - // // or stroke color is translucent. If we wouldn't clip to outside - // // the current shape, some pixels from the outline stroke overlapped - // // the (non-antialiased) fill. - // glStencilFunc(GL_EQUAL, 0x80, 0xBF); - // // } - - // switchShader(outlineShader); - // glUniformMatrix4fv(outlineShader->u_matrix, 1, GL_FALSE, matrix); - // glUniform2f(outlineShader->u_world, transform.fb_width, transform.fb_height); - // glUniform4f(outlineShader->u_color, color[0], color[1], color[2], color[3]); - // glLineWidth(2); - - // // Draw the entire line - // char *vertex_index = BUFFER_OFFSET(index.vertex_start * 2 * sizeof(uint16_t)); - // glVertexAttribPointer(outlineShader->a_pos, 2, GL_SHORT, GL_FALSE, 0, vertex_index); - // glLineWidth(2.0f); - // glDrawArrays(GL_LINE_STRIP, 0, index.length); - // } + // Because we're drawing top-to-bottom, and we update the stencil mask + // below, we have to draw the outline first (!) + if (antialiasing) { + + // if (layerStyle.stroke) { + // // If we defined a different color for the fill outline, we are + // // going to ignore the bits in 0x3F and just care about the global + // // clipping mask. + // glStencilFunc(GL_EQUAL, 0x80, 0x80); + // } else { + // Otherwise, we only want to draw the antialiased parts that are + // *outside* the current shape. This is important in case the fill + // or stroke color is translucent. If we wouldn't clip to outside + // the current shape, some pixels from the outline stroke overlapped + // the (non-antialiased) fill. + glStencilFunc(GL_EQUAL, 0x80, 0xBF); + // } + + switchShader(outlineShader); + glUniformMatrix4fv(outlineShader->u_matrix, 1, GL_FALSE, matrix); + glUniform2f(outlineShader->u_world, transform.fb_width, transform.fb_height); + glUniform4f(outlineShader->u_color, color[0], color[1], color[2], color[3]); + glLineWidth(2); + + // Draw the entire line + char *vertex_index = BUFFER_OFFSET(index.vertex_start * 2 * sizeof(uint16_t)); + glVertexAttribPointer(outlineShader->a_pos, 2, GL_SHORT, GL_FALSE, 0, vertex_index); + glLineWidth(2.0f); + glDrawArrays(GL_LINE_STRIP, 0, index.length); + } // Now finally, draw a tile-covering quad that paints the parts of the // image that we marked in the stencil buffer. |