is not changed n WIN_WIDTH, WIN_HEIGHT are not automatically updated! → Detect window resize event, and update parameters. Computer Graphics Course @Waseda University
n 1st parameter: Window for which event is detected (GLFWwindow*) n 2nd parameter: Pointer to callback function n Code snippet Computer Graphics Course @Waseda University (Assume callback is named “resizeGL”)
callback is fixed for each event type. n For window resize, it receives window pointer, new window width, and new window height. n Substitute new width and height to globally visible parameters. n Update window size managed by GLFW, and viewport. Computer Graphics Course @Waseda University
always in pixels n Obtain pixel-level window size from GLFW Computer Graphics Course @Waseda University Red part gives pixel-level window width and height. → Objects shown up correctly in both Windows and Mac
resizing such that the object is scaled property in both the cases where the window shape is landscape and portrait. n Hint: make your own routine of calculating projection matrix in such a case. Computer Graphics Course @Waseda University