From 14bf47c296f7ef80c91366a30b8ec593898e1e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 21 Mar 2017 15:01:32 +0100 Subject: [glfw] Remove GL state restoration We're doing all of this in our own context anyway, so no need to restore the state --- platform/glfw/glfw_view.cpp | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) (limited to 'platform/glfw') diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp index 82f075fd6f..b8cf285bdd 100644 --- a/platform/glfw/glfw_view.cpp +++ b/platform/glfw/glfw_view.cpp @@ -12,9 +12,6 @@ #include #include -#include -#include - #include #include @@ -567,14 +564,9 @@ void showDebugImage(std::string name, const char *data, size_t width, size_t hei glfwGetFramebufferSize(debugWindow, &fbWidth, &fbHeight); float scale = static_cast(fbWidth) / static_cast(width); - { - gl::PreserveState pixelZoom; - gl::PreserveState rasterPos; - - MBGL_CHECK_ERROR(glPixelZoom(scale, -scale)); - MBGL_CHECK_ERROR(glRasterPos2f(-1.0f, 1.0f)); - MBGL_CHECK_ERROR(glDrawPixels(width, height, GL_LUMINANCE, GL_UNSIGNED_BYTE, data)); - } + MBGL_CHECK_ERROR(glPixelZoom(scale, -scale)); + MBGL_CHECK_ERROR(glRasterPos2f(-1.0f, 1.0f)); + MBGL_CHECK_ERROR(glDrawPixels(width, height, GL_LUMINANCE, GL_UNSIGNED_BYTE, data)); glfwSwapBuffers(debugWindow); @@ -604,21 +596,13 @@ void showColorDebugImage(std::string name, const char *data, size_t logicalWidth float xScale = static_cast(fbWidth) / static_cast(width); float yScale = static_cast(fbHeight) / static_cast(height); - { - gl::PreserveState clearColor; - gl::PreserveState blend; - gl::PreserveState blendFunc; - gl::PreserveState pixelZoom; - gl::PreserveState rasterPos; - - MBGL_CHECK_ERROR(glClearColor(0.8, 0.8, 0.8, 1)); - MBGL_CHECK_ERROR(glClear(GL_COLOR_BUFFER_BIT)); - MBGL_CHECK_ERROR(glEnable(GL_BLEND)); - MBGL_CHECK_ERROR(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); - MBGL_CHECK_ERROR(glPixelZoom(xScale, -yScale)); - MBGL_CHECK_ERROR(glRasterPos2f(-1.0f, 1.0f)); - MBGL_CHECK_ERROR(glDrawPixels(width, height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, data)); - } + MBGL_CHECK_ERROR(glClearColor(0.8, 0.8, 0.8, 1)); + MBGL_CHECK_ERROR(glClear(GL_COLOR_BUFFER_BIT)); + MBGL_CHECK_ERROR(glEnable(GL_BLEND)); + MBGL_CHECK_ERROR(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); + MBGL_CHECK_ERROR(glPixelZoom(xScale, -yScale)); + MBGL_CHECK_ERROR(glRasterPos2f(-1.0f, 1.0f)); + MBGL_CHECK_ERROR(glDrawPixels(width, height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, data)); glfwSwapBuffers(debugWindow); -- cgit v1.2.1