diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-12-16 16:54:43 -0800 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-12-16 17:18:54 -0800 |
commit | a903d2eef022518ad579312555bf82272093e01a (patch) | |
tree | 4f71375ff05aaed9666200412b307548e638ebae /platform | |
parent | 9f18ed9a3ce7045753b72a86bf141b294f128bc1 (diff) | |
download | qtlocation-mapboxgl-a903d2eef022518ad579312555bf82272093e01a.tar.gz |
[glfw] Set viewport size from the Map thread
Setting the viewport size from the main thread has no affect
on Linux and thus, the map doesn't scale. We now set the
viewport size on the beforeRender() hook that gets called
from the Map thread.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/default/glfw_view.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp index c83e6c324b..9cb0ce69d9 100644 --- a/platform/default/glfw_view.cpp +++ b/platform/default/glfw_view.cpp @@ -81,8 +81,6 @@ 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"); @@ -333,8 +331,6 @@ 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); } @@ -434,7 +430,11 @@ void GLFWView::invalidate() { } void GLFWView::beforeRender() { - // no-op + // This is called from the map thread but `width` and `height` + // can be accessed with no race because the main thread is blocked + // when we render. This will be more straightforward when we move + // rendering to the main thread. + glViewport(0, 0, width, height); } void GLFWView::afterRender() { |