Added OpenGL error checking