diff options
Diffstat (limited to 'src/mbgl/renderer/paint_parameters.cpp')
-rw-r--r-- | src/mbgl/renderer/paint_parameters.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mbgl/renderer/paint_parameters.cpp b/src/mbgl/renderer/paint_parameters.cpp index 58dd5597a5..a7f621eb61 100644 --- a/src/mbgl/renderer/paint_parameters.cpp +++ b/src/mbgl/renderer/paint_parameters.cpp @@ -35,6 +35,10 @@ PaintParameters::PaintParameters(gl::Context& context_, // Update the default matrices to the current viewport dimensions. state.getProjMatrix(projMatrix); + // Also compute a projection matrix that aligns with the current pixel grid, taking into account + // odd viewport sizes. + state.getProjMatrix(alignedProjMatrix, 1, true); + // Calculate a second projection matrix with the near plane clipped to 100 so as // not to waste lots of depth buffer precision on very close empty space, for layer // types (fill-extrusion) that use the depth buffer to emulate real-world space. @@ -47,10 +51,10 @@ PaintParameters::PaintParameters(gl::Context& context_, } } -mat4 PaintParameters::matrixForTile(const UnwrappedTileID& tileID) { +mat4 PaintParameters::matrixForTile(const UnwrappedTileID& tileID, bool aligned) const { mat4 matrix; state.matrixFor(matrix, tileID); - matrix::multiply(matrix, projMatrix, matrix); + matrix::multiply(matrix, aligned ? alignedProjMatrix : projMatrix, matrix); return matrix; } |