From f05a530529ad57d2f97985f827657c22a9e8e6d9 Mon Sep 17 00:00:00 2001 From: Leith Bade Date: Mon, 12 Jan 2015 13:45:50 +1100 Subject: [PATCH] Correctly handle swapping. Fixes #666 --- platform/default/glfw_view.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp index 64a33321d..b3eed0080 100644 --- a/platform/default/glfw_view.cpp +++ b/platform/default/glfw_view.cpp @@ -58,6 +58,7 @@ void GLFWView::initialize(mbgl::Map *map_) { glfwSetWindowUserPointer(window, this); glfwMakeContextCurrent(window); + glfwSwapInterval(1); int width, height; glfwGetWindowSize(window, &width, &height); @@ -277,12 +278,6 @@ int GLFWView::run() { map->start(); while (!glfwWindowShouldClose(window)) { - if (map->needsSwap()) { - glfwSwapBuffers(window); - map->swapped(); - fps(); - } - glfwWaitEvents(); } @@ -306,7 +301,9 @@ void GLFWView::notify() { } void GLFWView::swap() { - glfwPostEmptyEvent(); + glfwSwapBuffers(window); + map->swapped(); + fps(); } void GLFWView::notifyMapChange(mbgl::MapChange /*change*/, mbgl::timestamp /*delay*/) {