I can then tell glfw to call that function whenever there is an error.
glfwSetErrorCallback(error_callback);
you can name the function and its parameters anything you like but the return type and parameter types must be the same as the api specifies, only a function pointer is passed to glfw.
you can change the handler as often as you like.
1 2 3 4 5 6 7 8 9 10
void startupErrorHandler(int error, constchar* description)
{
// do something about the startup error
}
void renderingErrorHandler(int error, constchar* description)
{
// do something about the rendering error
}
1 2 3 4 5 6 7
glfwSetErrorCallback(startupErrorHandler);
// do the startup stuff.
glfwSetErrorCallback(renderingErrorHandler);
// do the rendering