Zbuffer Test

Started by
0 comments, last by sakky 19 years, 7 months ago
How do you perferm a zbuffer test for a specific crc in C++. And is that how you check if a player is behind a wall or not?
Advertisement
Usually, you would let Direct3D or OpenGL take care of the Z-buffer aspects. You would enable Z-buffering with Direct3D with IDirect3DDevice9::SetRenderState and glEnable with OpenGL.

Z-buffering is the term for when two Z values are compared. The Z-buffer function is the condition that is used to accept or reject a value. Z-buffering can help with rendering. If an object is behind another object and it is drawn last; it will obviously overlap the first object. With Z-buffering, you can use the z value to help determine the proper pixel to be drawn. Hence, the object is back will lot overlap the object in front.

Technically, how the pixel is determined is based of the Z-function, or z-func for short. Some of these z-functions are: less-then, equal to, and greater then. The names of the functions give away there use with the Z-buffer.

You would not use Z-buffering to find if an object is behind a wall or not. You have to find another way of doing this. Try using the objects position relative to the walls position. I hope that helped. Look up on Google for collision detection algorithms, clicky! Or look here on GameDev
Take back the internet with the most awsome browser around, FireFox

This topic is closed to new replies.

Advertisement