Added OpenGL error checks