Made the OpenGL ifdefs much more robust