Depth test, BSP tree, performance...

Hi There!

First, sorry for my bad english.
I’m a newbie in opengl programming, on my bumpy path through Redbook. And I’ve become a bit confused.
Suppose that I plan to write a program which draw many houses in 3d and these houses consist of many prebuilt objects(walls, doors, windows, roof, etc). I’ve read in RB, that enabling depth test in opengl increase performance. Nearest object drawn, covered object not drawn, right? I’ve read something about frustum culling( it says: “DONT DRAW WHAT CANNOT BE SEEN.”) But depth test deal with hidden surface removal, then what need is there for frustum culling? Is anything outside a clipping plane “nothing” for opengl? And why programs need for (for example) BSP tree algorythm to increase performance of rendering of bigger scenes?
I will greatly appreciate any help!

With depth testing objects that are behind other objects (ie can’t be seen) are overwritten by the object in front so the display is correct. With depth testing the object in the background is still being drawn. It’s just overwritten by the object in front. Depth testing doesn’t do any sort of Culling (you need to use glEnable(GL_CULL_FACE) for that) it just makes the display look correct by checking the z value of the pixels. You need frustum culling which removes all the objects that are not in your immediate fov (field of view). This will massively speed up your OpenGL program. I’m not sure about BSP trees though.

If you have a really large scene, you can use a BSP tree to render a relatively smaller number of triangles. For most scenes this isn’t necissary because the hardware has a z-buffer which is very fast. I would only look into BSP trees if your application has a large number of triangles and you aren’t getting a high enough frame rate, or needs to be drawn back to front (say for alpha blending).

Brian

Thx guys!