深度缓冲区大小与视口大小相同吗?
如果我执行
#define SCREEN_SIZE 512
glEnable(GL_DEPTH_TEST);
glViewport(0, 0, SCREEN_SIZE, SCREEN_SIZE);
这会使我的深度缓冲区大小 SCREEN_SIZE x SCREEN_SIZE 吗?
If I perform
#define SCREEN_SIZE 512
glEnable(GL_DEPTH_TEST);
glViewport(0, 0, SCREEN_SIZE, SCREEN_SIZE);
Does this make my depth buffer size SCREEN_SIZE x SCREEN_SIZE?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不。深度缓冲区是窗口帧缓冲区的一部分。通常这样的窗口帧缓冲区由
组成。所有这些平面都具有相同的大小,即在其上创建 OpenGL 上下文的窗口的大小。视口仅定义将映射标准化设备坐标的 [-1, 1] 范围的窗口子集,即它选择帧缓冲区的一部分用作投影目标。视口甚至不需要裁剪视口范围“外部”的东西。如果您需要此功能,则必须将其与剪刀测试结合起来。
No. The depth buffer is part of the window frame buffer. Usually such a window framebuffer consists of
All these planes have the same size, namely the size of the window on which the OpenGL context has been created on. The viewport just defines the subset of the window that will be mapped the [-1, 1] range of normalized device coordinates, i.e. it selects a part of the framebuffer which will be used as projection target. The viewport doesn't even need to clip things "outside" the viewport range. If you need this, you must combine it with a scissor test.