可以“看穿” openGL 中的对象
我不确定为什么会发生这种情况,我只是渲染一些简单的原始四边形。 红色应该位于黄色之前。
黄色总是在红色前面,即使它在红色后面。
这是一个错误还是只是我错误地看到了立方体?
I'm not sure why this is happening, I'm only rendering a few simple primitive QUADS.
The red is meant to be in front of the yellow.
The yellow always goes in-front of the red, even when it's behind it.
Is this a bug or simply me seeing the cube wrongly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
打开深度缓冲区和深度测试,否则 OpenGL 会将后者绘制在顶部。
请参阅此处 http://www.opengl.org/resources/faq/technical/depthbuffer .htm
Turn the depth buffer and depth test on, or OpenGL would draw what is latter on the top.
See here http://www.opengl.org/resources/faq/technical/depthbuffer.htm
我遇到了同样的问题,但它与深度缓冲区无关,尽管当我启用它时,我确实看到了一些更好的变化。它与使用的混合函数有关,该函数在渲染的最后一步组合像素强度。所以我不得不关闭 glBlendFunc()
I had the same problem but it was unrelated to the depth buffer, although I did see some change for the better when I enabled that. It had to do with the blend functions used which combined pixel intensities at the last step of rendering. So I had to turn off glBlendFunc()