---
name: "clear_zbuffer"
section: "3alleg4"
platform: "linux"
package: "allegro4-doc"
version: "2:4.4.3.1-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/clear_zbuffer/3alleg4"
---

# clear\_zbuffer(3alleg4)

Writes a depth value into the given Z-buffer. Allegro game programming library.

## NAME

clear\_zbuffer - Writes a depth value into the given Z-buffer. Allegro game programming library.

## SYNOPSIS

**#include \<allegro.h\>**

**void clear\_zbuffer(ZBUFFER \*zbuf, float z);**

## DESCRIPTION

Writes z into the given Z-buffer (0 means far away). This function should be used to initialize the Z-buffer before each frame. Actually, low-level routines compare depth of the current pixel with 1/z: for example, if you want to clip polygons farther than 10, you must call clear\_zbuffer(zbuf, 0.1).

## SEE ALSO

**create\_zbuffer**(3alleg4), **set\_zbuffer**(3alleg4), **destroy\_zbuffer**(3alleg4), **exzbuf**(3alleg4)
