Here's a game programming tutorial but goes into the same direction..

Tutorial