Hi folks,

I saw this recently and thought of you guys:


He's clearly gone to some lengths to put the review together.


Posted on 2011-09-23 11:27:14 by michaelg
Some of the stuff he writes doesn't seem entirely correct though...
Yes, by default a GDI bitmap has the scanlines in reverse order compared to how they appear in videomemory.
However, if you specify a bitmap with negative height, the scanline order is reversed, and effectively it's the same as DirectDraw, or direct VGA framebuffer access in DOS, for example. I used to use a wrapper for DirectDraw and GDI that worked that way. The actual rendering required no modification.
I would think that Quake does the same thing... else Carmack just hasn't RTFM.

He also claims that OpenGL uses z rather than 1/z in the zbuffer.
That also seems incorrect. You want a good linear distribution of values. Using the reciprocal would mean that the values concentrate near 0. This only works if you use floating point. With integer values you would lose precision, and you'd get extreme z-fighting bugs (the other method DOES exist, but it is generally referred to as w-buffering rather than z-buffering. Most hardware didn't support floating point at all during the time of Quake 2, so this method is out of the question. Even today it is rarely used).
If OpenGL goes from 'dark to light' instead of 'light to dark', that probably only means that they map the values the other way around, and as such, they invert the z-test. But that is multiplying by a factor -1, rather than 1/z.

The rest is pretty much old news. Quake 2 is not a good basis for a modern renderer, be it software or hardware (not that I see any reason to still write a triangle-based software renderer today, with the programmable GPUs we have).
Posted on 2011-09-23 11:49:04 by Scali