In the allegro examples there's an example of a tethraedon
and a cube rotating so they are colliding, but the polygons
are drawed correctly and it should have something with z buffering
to do... Can somebody explain z buffering to me?
Printable View
In the allegro examples there's an example of a tethraedon
and a cube rotating so they are colliding, but the polygons
are drawed correctly and it should have something with z buffering
to do... Can somebody explain z buffering to me?
When drawing stuff in 3D space, you don't want an object which is behind another object to be drawn in front even if it is rendered last.
Therfore, a Z-buffer stores the Z coordinate for every pixel. When a new pixel is about to be drawn, it checks the Z-buffer if it's own Z-coordinate is in front of the Z-coordinate stored in the buffer. If not, it won't draw.