Thread: z buffer=?

  1. #1
    rebmeM roinuJ
    Join Date
    Mar 2003
    Posts
    8

    Question z buffer=?

    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?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    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.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed