what is depth buffer?

  • Follow


what is the meaning of depth buffer in opengl programming? Anyone
please explain to me. Thanks.
0
Reply quanghoc (2) 8/28/2003 6:54:37 AM

> what is the meaning of depth buffer in opengl programming? Anyone
> please explain to me. Thanks.


in general a depth buffer is a  32bit memory which represents every point of
your viewport.
But only the z-values(the depth of your primitives/points) are stored.
You could imagine it is working like a "sieve"(dunno if this word can be
used in this meaning).
If a pixel of a primitive is to be rendered to the screen, it's z-value is
written to the depth buffer where in simple words the following happens:

1.compare the z-value to be written with the existing z-value in buffer for
this pixel
2. if z-value<old z-value ->write this pixel
    else do not write this pixel

What you get in the end is a picture where objects are overlapped like in
reality.
Other ways to achive this is to draw all objects in a scene from back to
front, but this requieres sorting, which depth-buffers do not need.
BTW: this is not only a OpenGL thing, it's a widely used tech. in
computergraphics.

kind regards psy
p.s. my english is bad, i know^^




0
Reply Sebastian 8/28/2003 10:18:34 AM


Thanks. I got it now.
0
Reply quanghoc 8/29/2003 5:33:05 AM

2 Replies
461 Views

(page loaded in 0.054 seconds)

Similiar Articles:













7/22/2012 5:40:42 PM


Reply: