Enables or disables the z-buffer.



Argument Description
enable Switches on (true) or off (false) the z-buffer.

Returns: N/A


This function can be used to toggle on (true) and off (false) depth ordering using the z-buffer in 3D mode. The default value is that z-buffering is enabled.

When drawing in 3D, you normally want things to be drawn with depth along the z axis, so that an object "close" to the player is drawn over an object that is "further" away. When an object is rendered, the depth of a generated pixel (its z coordinate) is stored in the z-buffer, then, if another object of the scene must be rendered in the same pixel, the two depths are compared the one closer to the observer is then saved to the z-buffer, replacing the old one. However, this is not always what you wish to happen and there are moments when you may want something to be drawn over everything else, no matter what its z value is. In those cases you can use this function to switch off writing to the z-buffer and so force whatever is being drawn to be drawn over everything else.



The above code will switch off the z-buffer for all further drawing.

Back: 3D Setup
Next: d3d_start
© Copyright YoYo Games Ltd. 2018 All Rights Reserved