OpenGL 创建的 window 大小是原来的两倍
OpenGL created window size twice as large
我 运行 在 Macbook Pro 2015 上学习 OpenGL 教程。生成的 window 维度是设置的两倍大。 (例如,在代码中设置为 800x600,但得到的是 1600x1200)。代码尝试绘制的三角形位于左下方的 quad运行t,而它本应位于中心。
这可能是什么原因?
我运行这个code并没有做任何改变。
Link到截图。
来自 GLFW FAQ:
4.3 - Why is my output in the lower-left corner of the window?
You are passing the window size, which is in screen coordinates, to
glViewport, which works with pixels. On OS X with a Retina display,
and possibly on other platforms in the future, screen coordinates and
pixels do not map 1:1. Use the framebuffer size, which is in pixels,
instead of the window size. See the Window handling guide for details.
我 运行 在 Macbook Pro 2015 上学习 OpenGL 教程。生成的 window 维度是设置的两倍大。 (例如,在代码中设置为 800x600,但得到的是 1600x1200)。代码尝试绘制的三角形位于左下方的 quad运行t,而它本应位于中心。
这可能是什么原因?
我运行这个code并没有做任何改变。
Link到截图。
来自 GLFW FAQ:
4.3 - Why is my output in the lower-left corner of the window?
You are passing the window size, which is in screen coordinates, to glViewport, which works with pixels. On OS X with a Retina display, and possibly on other platforms in the future, screen coordinates and pixels do not map 1:1. Use the framebuffer size, which is in pixels, instead of the window size. See the Window handling guide for details.