I have been learning about OpenGL recently, and was searching information about error handling. I learned to use
glGetError to set the error flag and created a function that prints its hexadecimal value. The relevant C++ code looks like this:
GLClearError(); glDrawElements(GL_TRIANGLES, 6, GL_INT, nullptr); GLCheckError();
with GL_INT written on purpose.
GLClearError() just clears the error flag and
GlCheckError() prints the errors produced by
500 as an output. I know I can go (in my case, as I use GLEW) to glew.h and search for the error with this number. In this case, the error is
GL_INVALID_ENUM. It's a compiler definition; my question then is the following: is it possible to create in C++ a function that returns the definition name by entering its value? I use C++ 11, OpenGL 4.6 and GLEW 2.1, if that changes anything.