Fix code to work with ghc-7.3.2 stage 2

Add missing dependencies.
Function texImage2D interface has changed.