Minimal changes to fix current issues (deprecated use, warning and OpenGL errors)

Here are the minimal changes to Fix all the errors I encountered under Windows 7 / nvidia driver 340.52 and Linux mint 17 nvidia driver 331 and optimus. (mainly a black screen and a "invalid operation" when glGetError())
Cheers