Lots of little fixes, plus chapter 9 example.

A lot of this code looks very similar to Example_X_ClientSideDistortion.cpp.  Did you consider using a shared base class?