From 460e5d792dac0d2de16ba0a38a1181a1e4340f2c Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 21 Jul 2015 21:58:24 +0200 Subject: [PATCH] Fixed splitview example on Retina displays. --- examples/splitview.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/examples/splitview.c b/examples/splitview.c index 1ffcda67..ac0ffce5 100644 --- a/examples/splitview.c +++ b/examples/splitview.c @@ -383,6 +383,17 @@ static void windowRefreshFun(GLFWwindow* window) static void cursorPosFun(GLFWwindow* window, double x, double y) { + int wnd_width, wnd_height, fb_width, fb_height; + double scale; + + glfwGetWindowSize(window, &wnd_width, &wnd_height); + glfwGetFramebufferSize(window, &fb_width, &fb_height); + + scale = (double) fb_width / (double) wnd_width; + + x *= scale; + y *= scale; + // Depending on which view was selected, rotate around different axes switch (active_view) {