summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-11-04 17:01:22 +0100
committerKonstantin Käfer <mail@kkaefer.com>2016-11-04 21:24:05 +0100
commit008a83b91584b8cf406264c5378bdd7ef87683ec (patch)
tree661e94fe3eb7bcb39a0e93acefce6e30e3d6b3f5 /src/mbgl/renderer
parent176730bff64fc8f935e3337f870b2ff2a930ed15 (diff)
downloadqtlocation-mapboxgl-008a83b91584b8cf406264c5378bdd7ef87683ec.tar.gz
[core] add state tracking to pixel store packing alignment
Diffstat (limited to 'src/mbgl/renderer')
-rw-r--r--src/mbgl/renderer/painter_debug.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/mbgl/renderer/painter_debug.cpp b/src/mbgl/renderer/painter_debug.cpp
index a502c3eddf..1db2167b71 100644
--- a/src/mbgl/renderer/painter_debug.cpp
+++ b/src/mbgl/renderer/painter_debug.cpp
@@ -68,12 +68,10 @@ void Painter::renderClipMasks(PaintParameters&) {
context.program = 0;
#if not MBGL_USE_GLES2
- context.pixelZoom = { 1, 1 };
- context.rasterPos = { -1, -1, 0, 0 };
// When reading data from the framebuffer, make sure that we are storing the depth values
// tightly packed into the buffer to avoid buffer overruns. Also see unpacking adjustment below.
- MBGL_CHECK_ERROR(glPixelStorei(GL_PACK_ALIGNMENT, 1));
+ context.pixelStorePack = { 1 };
// Read the stencil buffer
const auto viewport = context.viewport.getCurrentValue();
@@ -96,8 +94,9 @@ void Painter::renderClipMasks(PaintParameters&) {
*it *= factor;
}
- MBGL_CHECK_ERROR(glPixelStorei(GL_UNPACK_ALIGNMENT, 1));
- MBGL_CHECK_ERROR(glWindowPos2i(viewport.x, viewport.y));
+ context.pixelZoom = { 1, 1 };
+ context.rasterPos = { -1, -1, 0, 1 };
+ context.pixelStoreUnpack = { 1 };
MBGL_CHECK_ERROR(glDrawPixels(viewport.size.width, viewport.size.height, GL_LUMINANCE,
GL_UNSIGNED_BYTE, pixels.get()));
#endif // MBGL_USE_GLES2
@@ -110,12 +109,10 @@ void Painter::renderDepthBuffer(PaintParameters&) {
context.program = 0;
#if not MBGL_USE_GLES2
- context.pixelZoom = { 1, 1 };
- context.rasterPos = { -1, -1, 0, 0 };
// When reading data from the framebuffer, make sure that we are storing the depth values
// tightly packed into the buffer to avoid buffer overruns. Also see unpacking adjustment below.
- MBGL_CHECK_ERROR(glPixelStorei(GL_PACK_ALIGNMENT, 1));
+ context.pixelStorePack = { 1 };
// Scales the values in the depth buffer so that they cover the entire grayscale range. This
// makes it easier to spot tiny differences.
@@ -137,8 +134,9 @@ void Painter::renderDepthBuffer(PaintParameters&) {
pixels.get() // GLvoid * data
));
- MBGL_CHECK_ERROR(glPixelStorei(GL_UNPACK_ALIGNMENT, 1));
- MBGL_CHECK_ERROR(glWindowPos2i(viewport.x, viewport.y));
+ context.pixelZoom = { 1, 1 };
+ context.rasterPos = { -1, -1, 0, 1 };
+ context.pixelStoreUnpack = { 1 };
MBGL_CHECK_ERROR(glDrawPixels(viewport.size.width, viewport.size.height, GL_LUMINANCE,
GL_UNSIGNED_BYTE, pixels.get()));
#endif // MBGL_USE_GLES2