April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
ZBuffer - pseudo-código
void ZBuffer( void) {
 int x,y;
 for (x=0; x<w; x++) {
   for (y=0;y<h; y++) {
       WritePixel(x,y, bck_color);
       WriteZ(x,y,0);
   }
 }
  for (each primitive) {
    for (each pixel in the projected primitive) {
       double pz = z coordinate of the (x,y) pixel;
       if  (pz <= ReadZ(x,y)) {
          WritePixel(x,y, color);
          WriteZ(x,y,pz);
        }
    }
  }
} /* Zbuffer */
void glEnable( GL_DEPTH_TEST );