how to realize Z-buffer algorithm with C/C++ no on top of opengl?

please tell me how and where to get the source code for Z-buffer algrithm no based opengl!
Thanks!

A Z-buffer is not an algo, it is just a … buffer.
You want a “triangle rasterizer” with z interpolation.

Some links:
http://sw-shader.sourceforge.net/rasterizer.html

http://www.exaflop.org/docs/fatmap/ind.html#Constant%20texture%20gradients%20and%20polygons