From f313234c9ae16f5f00f077254be6b332e95f968a Mon Sep 17 00:00:00 2001 From: "J. de Vries" Date: Sat, 30 Apr 2016 11:38:05 +0200 Subject: [PATCH] Fix viewport display for high-DPI devices. --- src/1.getting_started/1.hello_window/hellowindow2.cpp | 4 +++- src/1.getting_started/2.hello_triangle/hellotriangle2.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/1.getting_started/1.hello_window/hellowindow2.cpp b/src/1.getting_started/1.hello_window/hellowindow2.cpp index 04d3890..67eaaaa 100644 --- a/src/1.getting_started/1.hello_window/hellowindow2.cpp +++ b/src/1.getting_started/1.hello_window/hellowindow2.cpp @@ -49,7 +49,9 @@ int main() } // Define the viewport dimensions - glViewport(0, 0, WIDTH, HEIGHT); + int width, height; + glfwGetFramebufferSize(window, &width, &height); + glViewport(0, 0, width, height); // Game loop while (!glfwWindowShouldClose(window)) diff --git a/src/1.getting_started/2.hello_triangle/hellotriangle2.cpp b/src/1.getting_started/2.hello_triangle/hellotriangle2.cpp index cbbf95e..6bf2e90 100644 --- a/src/1.getting_started/2.hello_triangle/hellotriangle2.cpp +++ b/src/1.getting_started/2.hello_triangle/hellotriangle2.cpp @@ -53,7 +53,9 @@ int main() glewInit(); // Define the viewport dimensions - glViewport(0, 0, WIDTH, HEIGHT); + int width, height; + glfwGetFramebufferSize(window, &width, &height); + glViewport(0, 0, width, height); // Build and compile our shader program