开发者

Why do you need the depth buffer?

I don't understand why I need to use depth buffer, because in this project cube draws without d开发者_运维技巧epth buffer.

Sorry for my bad English. I'm russian and started to learn English 1.5 years ago.


When doing simple rendering where it's easy to determine which surfaces occlude others, for instance, just by depth sorting the surfaces, then the depth buffer is an unnecessary burden. In more realistic rendering scenarios, particularly when surfaces can intersect, no amount of depth sorting will produce correct results. the depth buffer allows you to draw surfaces in any order, and preserves only the rendering that is closest to the screen. This can actually improve performance for non-trivial scenes.


Not iPhone related, but a depth buffer (or z-buffer) will allow drawing the faces in any order and still have them rendered correctly.

Read some tutorials about it (use Google), images will illustrate better. See this tutorial for instance.

Why do you need the depth buffer?

Depth Buffer enabled

Why do you need the depth buffer?

Depth Buffer disabled


That project above is full of hacks, unfortunately - had me confused as well.

If you want 3D, use a depth buffer, enable depth testing, and don't do front face culling like in that cube example.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜