Check Texture Mapping, same Idea, just it interpolates 1/x as apposed to X as to correct the perspective, one problem, you require a divide within your inner loop which tends to slow the routine down quite a bit, don't bother, just learn Direct X...