Added error callback.

This commit is contained in:
Camilla Berglund 2012-04-09 17:41:17 +02:00
parent 877c6337c3
commit 67a3f5dc8f

View File

@ -88,6 +88,11 @@ static void size_callback(GLFWwindow window, int width, int height)
glViewport(0, 0, width, height); glViewport(0, 0, width, height);
} }
static void error_callback(int error, const char* description)
{
fprintf(stderr, "Error: %s in %s\n", glfwErrorString(error), description);
}
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
int ch; int ch;
@ -107,6 +112,8 @@ int main(int argc, char** argv)
} }
} }
glfwSetErrorCallback(error_callback);
if (!glfwInit()) if (!glfwInit())
{ {
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError())); fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));