diff --git a/src/main.cc b/src/main.cc index e3d87bc..14cb350 100644 --- a/src/main.cc +++ b/src/main.cc @@ -56,6 +56,14 @@ GLuint g_program_id = 0; static GLuint translate_unif; static GLuint rotate_unif; +void framebuffer_size_callback(GLFWwindow* window, int width, int height) +{ + // make sure the viewport matches the new window dimensions; note that width and + // height will be significantly larger than specified on retina displays. + glViewport(0, 0, width, height); + // Re-render the scene because the current frame was drawn for the old resolution +} + static void init_shaders() { dbg_log("Initialising shaders"); @@ -134,6 +142,7 @@ int main() { // Set up the key handler glfwSetKeyCallback(w, key_callback); + glfwSetFramebufferSizeCallback(w, framebuffer_size_callback); init_opengl();