I am learning OpenGL and I am using the GLFW library. I am trying to understand what the documentation means by screen coordinate and the framebuffer of a window. Hence, I logged the width and height output of both of these functions, but they are identical. So I am not so sure what the difference between glfwGetWindowSize
and glfwGetFramebufferSize
is.
Also, can I have a clarification on what is the difference between framebuffer size and the size of the window in screen coordinates? (Both of these two size are mentioned in the documentation but have no explanation. Furthermore, these two sizes correspond to glfwGetFramebufferSize
and glfwGetWindowSize
respectively).
GLFW explains both coordinate systems in there documentation here and here.
In short, window coordinates are relative to the monitor and/or the window and are given in artificial units that do not necessarily correspond to real screen pixels. This is especially the case when dpi scaling is activated (for example, on Macs with retina display).
Framebuffer sizes are, in contrast to the window coordinates, given in pixels in order to match OpenGLs requirements for glViewport
.
Note, that on some systems window coordinates and pixel coordinates can be the same but this is not necessarily true.