I am using OpenGL’s z-buffer for scientific caclulations. I want to emulate what OpenGL does in software, but the code I wrote is giving me different results with respect to the z-buffer values and the rasterized pixels on the edges of polygons. I know that its impossible to get the exact same values since OpenGL uses non linear accuracy and usually 24bits for the z-buffer, but does anyone know where can I find any specifications about OpenGL’s rasterizer (for example how exactly does it do the rounding of floats to integers,the interpolation between z-values etc), or even better some code?
have a look at mesa3d which implements opengl in software and comes with full source code.
And there’s the OpenGL sample implementation by SGI: