This is less a specific answer to the question, but a general hint on how to set up an OpenGL context because iI feel it will answer the question automatically. The same procedure is used for instance by 'learnopengl.com' and possibly others I don't know. My system is a Debian 10, but it should work on Windows as well.
1.) - Headers to be included:
2.) - Initialize glfw, load opengl functions:
Now two things are still mssingmissing, the glfw_debug_callbackglfw_debug_callback and the glDebugCallbackglDebugCallback. I leave the function body out because mines aremine is pretty verbose:
void APIENTRY glDebugOutput( GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const GLchar *message, const void *userParam ) {
// Ignore non-significant error/warning codes
// pseudcode: if( id == 131169 || id = whateverelse ) return;
/* stitch togehter and format a msg from source:
GL_DEBUG_SOURCE_API, GL_DEBUG_SOURCE_WINDOW_SYSTEM,
GL_DEBUG_SOURCE_SHADER_COMPILER, GL_DEBUG_SOURCE_THIRD_PARTY,
GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_SOURCE_OTHER
type:
GL_DEBUG_TYPE_ERROR, GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR;
GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR, GL_DEBUG_TYPE_PORTABILITY,
GL_DEBUG_TYPE_PERFORMANCE, GL_DEBUG_TYPE_MARKER,
GL_DEBUG_TYPE_PUSH_GROUP, GL_DEBUG_TYPE_POP_GROUP,
GL_DEBUG_TYPE_OTHER
and severity:
GL_DEBUG_SEVERITY_HIGH, GL_DEBUG_SEVERITY_MEDIUM,
GL_DEBUG_SEVERITY_LOW, GL_DEBUG_SEVERITY_NOTIFICATION */
// add the message text and eventually add userdata
// log/output
}
}
With this one receives meaningfullmeaningful messages on error conditions. Checking glErrorglError is not necessary any more and parametrizedparameterized one can run with a debug context and without, saving a bit of performance.