question about frame buffer and z buffer

Hi, just wondering what is the difference between them? thanks!

Hi !

If you have a look at the OpenGL spec you will get lots of information on how the internals of OpenGL work.

The frame buffer is where the final pixels are stored that make up the rendered image, in the z buffer/depth buffer (same thing) a value is saved for each pixel telling how far from the viewer that pixel is, so if we try to put another pixel (at the same position) that is “behind” the one that is already in the buffer it will not be rendered because it is not visible anyway, this makes it possible to render the polygons in any order and it will still look correct in the end.


As a side note, a particular attention is made by the OpenGL spec not to mess up Z and Depth. Programmers often end up in telling Z=depth but in practice it’s not the same thing.