JOGL 纹理是半透明的
抱歉,如果这是一个简单的修复,但我似乎找不到解决方案。
我创建了一个通过制作四个四边形进行纹理化的盒子。但是,当我旋转盒子以查看其渲染方式时,本应不可见的纹理显示在其他纹理的顶部。
我认为这与它们的渲染顺序有关。我首先渲染盒子的正面,这样当我旋转到背面时,前面的纹理就会显示在背面。
我记得看到过一些关于“剔除”的内容,但我找不到任何文档。任何帮助我指明正确方向的帮助将不胜感激!
Sorry if this is a simple fix, but I can't seem to find the solution.
I've created a box that is textured by making four quads. However, when I rotate the box around to see how it rendered, the textures that should be should not be visible are displayed on the top of the other textures.
I think this has to do with the order in which they are rendered. I render the front face of the box first, so that when I rotate to the back, the front texture is displayed over the back.
I recall seeing something about 'culling' but I can't find any documentation. Any help to point me in the right direction would be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先确保您启用了深度测试并且框中四边形的“z”值正确。您的问题似乎是您对四边形使用相同的深度值,或者只是禁用了深度测试。
快速搜索给了我这个链接。希望它会有所帮助。
http://www.leolol.com/drupal/tutorials/3d-graphics-jogl-opengl-etc/jogl-lesson-4-3d-shapes-and-rotation-opengl
PS :您这篇文章的标题不支持您的问题:(
First Make sure you enabled Depth test and also 'z' values of the quads in the box are correct. Your problem seems like you are using same depth values for the quads or just having depth test disabled.
A quick search gave me this link.Hope it will help.
http://www.leolol.com/drupal/tutorials/3d-graphics-jogl-opengl-etc/jogl-lesson-4-3d-shapes-and-rotation-opengl
PS: your title for this post doesn't support your question :(
这听起来(虽然看起来更好,意味着一些代码)更像是深度测试问题而不是剔除问题。您确定启用了深度测试 (
glEnable(GL_DEPTH_TEST)
) 并检索了带有深度缓冲区的上下文吗?This sounds (although looking would be better, meaning some code) rather like a depth testing issue than a culling issue. Are you sure you enabled depth testing (
glEnable(GL_DEPTH_TEST)
) and retrieved a context with a depth buffer?