GLBasic User Manual

Main sections

X_CLEAR_Z

X_CLEAR_Z


Clears the depth buffer bits.
With this command, any 3D object that has been drawn before this command becomes a background object. As such, the objects that you draw from this point, no matter how far they are from the camera, will always be drawn in front of the "background" objects.

This command is useful for example when it comes to drawing a skybox (a skybox is a box that surrounds your whole 3D environment with images of distant scenery to add realism to your 3D world).
To draw the skybox, create a textured cube 1 unit in size around your camera, run X_CLEAR_Z, and then draw the rest of your world. Even if objects in your world are 1000 units away from the camera, they will be drawn in front of your skybox.

See also...