Look at the first image on this page:

http://msdn.microsoft.com/en-us/library/windows/de sktop/cc627092(v=vs.85).aspxImagine that each square there represents one pixel, and the cross in the center is where you "paint" the pixel. You have specified the triangle's vertices with (x,y) coordinates that include decimals.

So what you want to do in order to rasterize a triangle, is to interpolate down along both edges of the triangle until you reach the first row of pixel centers. At that moment you know which pixel-centers on that scanline are covered by that span. Then, if you want to apply any shading/texturing when rendering the span, you start from the leftmost edge, and interpolate horizontally till you reach the first pixel center; paint, interpolate to the next pixel center, etc.

Then interpolate down along both edges till you reach the next row of pixel centers. Repeat.

In practice this works out as a vertical (per-edge) and a horizontal (per-scanline) pre-step. Grab your pen & paper and draw some figures, that usually helps.

The source code in the article at

http://www.lysator.liu.se/~mikaelk/doc/perspective texture/ does subpixel correction and is reasonably well commented (albeit without any pretty pictures).