Sample code for Advanced Graphics (Cambridge University)