OpenGL has a feature called Debug Output that helps debugging and improving OpenGL programs simpler.
In a nutshell, this functionality offers a way for the driver to send text message data back to the application. Additionally, it offers a way for a program to add its own debugging messages to the stream and annotate GL objects with names that are human readable.