---
name: "clear_zbuffer"
section: "3alleg"
platform: "linux"
package: "liballegro-doc"
version: "2:4.2.2-2.2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/clear_zbuffer"
---

# clear\_zbuffer(3alleg)

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**(3alleg)](/create_zbuffer/3alleg.md), [**set\_zbuffer**(3alleg)](/set_zbuffer/3alleg.md), [**destroy\_zbuffer**(3alleg)](/destroy_zbuffer/3alleg.md), [**exzbuf**(3alleg)](/exzbuf/3alleg.md)
