DirectX/OpenGL 中的三角形绘制顺序 [英] Triangle drawing order in DirectX/OpenGL

查看:37
本文介绍了DirectX/OpenGL 中的三角形绘制顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否保证在 3D API 中绘制三角形的顺序与它们在索引缓冲区中的顺序相同?

Is the order of drawing triangles in a 3D APIs guaranteed to be the same as their order in the index buffer?

例如,如果我在一次绘制调用中有两个重叠的三角形,并且禁用了深度测试,那么最后第一个或第二个三角形是否可见?

For example if I have two overlapping triangles in a single draw call, and depth testing is disabled, will the first or second triangle be visible in the end?

或者我是否需要发出单独的绘制调用以确保第二个三角形出现在第一个三角形的顶部?

Or do I need to issue separate draw calls to be sure that the 2nd triangle appears on top of the 1st?

推荐答案

在 OpenGL 中确实保留了顺序,因此可以使用画家算法,例如在渲染半透明几何体时.

In OpenGL the order is indeed preserveed, so that painters algorithm can be used, for example when rendering semitransparent geometry.

Direct3D 我不确定,但我想说同样适用于那里.

Direct3D I don't know for sure, but I'd say the same applies there.

这篇关于DirectX/OpenGL 中的三角形绘制顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆