opengl

let me know cleary what is the difference between SINGLE and DOUBLE buffering and the use of DEPTH

Single buffering is when the image is drawn directly to the screen. The problems with this is that you can see everything being drawn. This tends to lead to a flickering image.

The way to get around it is to use double buffering where it creates 2 frame buffers. One is viewable (the front) and one isn’t(the back). When drawing you draw to the back buffer and then swap the two around to view your image.

Depth buffering uses an additional buffer to hold a single depth value (usually 16 or 24bit). When pixels are drawn to the frame buffer the distance from the camera is stored in the depth buffer. All pixels are then tested with the value if they are to be drawn in the same place. The pixels are only drawn if the new pixel is closer to the camera (if the depth value is LESS than the current value).

You can change the depth test using glDepthFunc().