summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-05-23 19:15:10 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-05-24 19:58:24 +0300
commit1769e6fcb42d41e042c488bf2023fed360b87357 (patch)
tree4febd99199574ecc2a84bcc2012ae7c80e445c53 /platform
parent876bf0687a6e2b6b5dd491b65dad587c688aa56d (diff)
downloadqtlocation-mapboxgl-1769e6fcb42d41e042c488bf2023fed360b87357.tar.gz
[core] Move GLFW stencil clip debug to core
This makes the stencil clip debug available to all platforms. Fixes #4669.
Diffstat (limited to 'platform')
-rw-r--r--platform/default/glfw_view.cpp51
1 files changed, 0 insertions, 51 deletions
diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp
index e3a38114bd..f5fdb60df7 100644
--- a/platform/default/glfw_view.cpp
+++ b/platform/default/glfw_view.cpp
@@ -141,9 +141,6 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
if (!mods)
view->map->resetPosition();
break;
- case GLFW_KEY_C:
- view->toggleClipMasks();
- break;
case GLFW_KEY_S:
if (view->changeStyleCallback)
view->changeStyleCallback();
@@ -256,11 +253,6 @@ void GLFWView::nextOrientation() {
}
}
-void GLFWView::toggleClipMasks() {
- showClipMasks = !showClipMasks;
- map->update(mbgl::Update::Repaint);
-}
-
void GLFWView::addRandomCustomPointAnnotations(int count) {
std::vector<mbgl::PointAnnotation> points;
@@ -432,10 +424,6 @@ void GLFWView::run() {
map->render();
- if (showClipMasks) {
- renderClipMasks();
- }
-
glfwSwapBuffers(window);
report(1000 * (glfwGetTime() - started));
@@ -480,45 +468,6 @@ void GLFWView::invalidate() {
glfwPostEmptyEvent();
}
-void GLFWView::renderClipMasks() {
- // Read the stencil buffer
- auto pixels = std::make_unique<uint8_t[]>(fbWidth * fbHeight);
- glReadPixels(0, // GLint x
- 0, // GLint y
- fbWidth, // GLsizei width
- fbHeight, // GLsizei height
- GL_STENCIL_INDEX, // GLenum format
- GL_UNSIGNED_BYTE, // GLenum type
- pixels.get() // GLvoid * data
- );
-
- // Scale the Stencil buffer to cover the entire color space.
- auto it = pixels.get();
- auto end = it + fbWidth * fbHeight;
- const auto factor = 255.0f / *std::max_element(it, end);
- for (; it != end; ++it) {
- *it *= factor;
- }
-
- using namespace mbgl::gl;
- Preserve<PixelZoom> pixelZoom;
- Preserve<RasterPos> rasterPos;
- Preserve<StencilTest> stencilTest;
- Preserve<DepthTest> depthTest;
- Preserve<Program> program;
- Preserve<ColorMask> colorMask;
-
- MBGL_CHECK_ERROR(glPixelZoom(1.0f, 1.0f));
- MBGL_CHECK_ERROR(glRasterPos2f(-1.0f, -1.0f));
- MBGL_CHECK_ERROR(glDisable(GL_STENCIL_TEST));
- MBGL_CHECK_ERROR(glDisable(GL_DEPTH_TEST));
- MBGL_CHECK_ERROR(glUseProgram(0));
- MBGL_CHECK_ERROR(glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE));
- MBGL_CHECK_ERROR(glWindowPos2i(0, 0));
-
- MBGL_CHECK_ERROR(glDrawPixels(fbWidth, fbHeight, GL_LUMINANCE, GL_UNSIGNED_BYTE, pixels.get()));
-}
-
void GLFWView::report(float duration) {
frames++;
frameTime += duration;