z buffer=?

This is a discussion on z buffer=? within the Game Programming forums, part of the General Programming Boards category; In the allegro examples there's an example of a tethraedon and a cube rotating so they are colliding, but the ...

  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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21