When we call a function from the OpenGL API we may be calling it incorrectly, and this is what
glGetError is good for. “Incorrectly” can mean several things, for instance, the parameters are not in a valid range, or a function is being called without a proper context.
Every time an error is detected a flag is set and a numeric code is recorded. Any errors afterwards won’t be recorded so we need to make sure we check for errors at the most significant points in your application.
This page describes in detail the behaviour of