summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-12-03 17:46:28 +0100
committerKonstantin Käfer <mail@kkaefer.com>2015-12-10 14:16:11 -0800
commit93c000dd18f5896b6d0c5b3f1670c999489c2f12 (patch)
treecfc61766f13137b6be5f35fb82e657eed80bcddd
parentbd56c8634bf0683d9ee45e95a07694ed43f3ac05 (diff)
downloadqtlocation-mapboxgl-93c000dd18f5896b6d0c5b3f1670c999489c2f12.tar.gz
[core] viewport is handled by embedding applications
-rw-r--r--platform/default/glfw_view.cpp4
-rw-r--r--platform/default/headless_view.cpp2
-rw-r--r--src/mbgl/renderer/gl_config.cpp1
-rw-r--r--src/mbgl/renderer/gl_config.hpp20
-rw-r--r--src/mbgl/renderer/painter.cpp3
5 files changed, 6 insertions, 24 deletions
diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp
index 302f108e2f..418f427c74 100644
--- a/platform/default/glfw_view.cpp
+++ b/platform/default/glfw_view.cpp
@@ -81,6 +81,8 @@ GLFWView::GLFWView(bool fullscreen_, bool benchmark_)
glfwGetFramebufferSize(window, &fbWidth, &fbHeight);
pixelRatio = static_cast<float>(fbWidth) / width;
+ glViewport(0, 0, fbWidth, fbHeight);
+
glfwMakeContextCurrent(nullptr);
printf("\n");
@@ -317,6 +319,8 @@ void GLFWView::onFramebufferResize(GLFWwindow *window, int width, int height) {
view->fbWidth = width;
view->fbHeight = height;
+ glViewport(0, 0, width, height);
+
view->map->update(mbgl::Update::Repaint);
}
diff --git a/platform/default/headless_view.cpp b/platform/default/headless_view.cpp
index 55a8c57773..f94b924daf 100644
--- a/platform/default/headless_view.cpp
+++ b/platform/default/headless_view.cpp
@@ -156,6 +156,8 @@ void HeadlessView::resizeFramebuffer() {
throw std::runtime_error(error);
}
+ MBGL_CHECK_ERROR(glViewport(0, 0, w, h));
+
needsResize = false;
}
diff --git a/src/mbgl/renderer/gl_config.cpp b/src/mbgl/renderer/gl_config.cpp
index 0485878297..4160ae100e 100644
--- a/src/mbgl/renderer/gl_config.cpp
+++ b/src/mbgl/renderer/gl_config.cpp
@@ -19,7 +19,6 @@ const ClearColor::Type ClearColor::Default = { 0, 0, 0, 0 };
const ClearStencil::Type ClearStencil::Default = 0;
const Program::Type Program::Default = 0;
const LineWidth::Type LineWidth::Default = 1;
-const Viewport::Type Viewport::Default = { 0, 0, 0, 0 };
} // namespace gl
} // namespace mbgl
diff --git a/src/mbgl/renderer/gl_config.hpp b/src/mbgl/renderer/gl_config.hpp
index 55590cf665..2f21b35fe3 100644
--- a/src/mbgl/renderer/gl_config.hpp
+++ b/src/mbgl/renderer/gl_config.hpp
@@ -266,23 +266,6 @@ struct LineWidth {
}
};
-struct Viewport {
- struct Type { GLint x, y; GLsizei width, height; };
- static const Type Default;
- inline static void Set(const Type& value) {
- MBGL_CHECK_ERROR(glViewport(value.x, value.y, value.width, value.height));
- }
- inline static Type Get() {
- GLint viewport[4];
- MBGL_CHECK_ERROR(glGetIntegerv(GL_VIEWPORT, viewport));
- return { viewport[0], viewport[1], viewport[2], viewport[3] };
- }
-};
-
-inline bool operator!=(const Viewport::Type& a, const Viewport::Type& b) {
- return a.x != b.x || a.y != b.y || a.width != b.width || a.height != b.height;
-}
-
class Config {
public:
void reset() {
@@ -302,7 +285,6 @@ public:
clearStencil.reset();
program.reset();
lineWidth.reset();
- viewport.reset();
}
void setDirty() {
@@ -322,7 +304,6 @@ public:
clearStencil.setDirty();
program.setDirty();
lineWidth.setDirty();
- viewport.setDirty();
}
Value<StencilFunc> stencilFunc;
@@ -341,7 +322,6 @@ public:
Value<ClearStencil> clearStencil;
Value<Program> program;
Value<LineWidth> lineWidth;
- Value<Viewport> viewport;
};
} // namespace gl
diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp
index fb74d5b8e6..cab9d49212 100644
--- a/src/mbgl/renderer/painter.cpp
+++ b/src/mbgl/renderer/painter.cpp
@@ -91,8 +91,6 @@ void Painter::render(const Style& style, const FrameData& frame_, SpriteAtlas& a
const std::set<Source*>& sources = renderData.sources;
const Color& background = renderData.backgroundColor;
- config.viewport = { 0, 0, frame.framebufferSize[0], frame.framebufferSize[1] };
-
// Update the default matrices to the current viewport dimensions.
state.getProjMatrix(projMatrix);
@@ -235,7 +233,6 @@ void Painter::renderPass(RenderPass pass_,
config.colorMask = { GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE };
config.stencilMask = 0x0;
- config.viewport = { 0, 0, frame.framebufferSize[0], frame.framebufferSize[1] };
if (layer.is<BackgroundLayer>()) {
MBGL_DEBUG_GROUP("background");