GLFW: Add an error callback before calling glfwInit()

It will print a message to know what happened in case something went wrong in a GLFW call.

Also replace every printf() in the glfw emu-window by ERROR_LOG().
This commit is contained in:
Emmanuel Gil Peyrot 2014-11-28 23:35:57 +00:00
parent 83c3d37cd0
commit 648743cf66

View file

@ -58,9 +58,13 @@ EmuWindow_GLFW::EmuWindow_GLFW() {
ReloadSetKeymaps(); ReloadSetKeymaps();
glfwSetErrorCallback([](int error, const char *desc){
ERROR_LOG(GUI, "GLFW 0x%08x: %s", error, desc);
});
// Initialize the window // Initialize the window
if(glfwInit() != GL_TRUE) { if(glfwInit() != GL_TRUE) {
printf("Failed to initialize GLFW! Exiting..."); ERROR_LOG(GUI, "Failed to initialize GLFW! Exiting...");
exit(1); exit(1);
} }
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
@ -75,7 +79,7 @@ EmuWindow_GLFW::EmuWindow_GLFW() {
window_title.c_str(), NULL, NULL); window_title.c_str(), NULL, NULL);
if (m_render_window == NULL) { if (m_render_window == NULL) {
printf("Failed to create GLFW window! Exiting..."); ERROR_LOG(GUI, "Failed to create GLFW window! Exiting...");
exit(1); exit(1);
} }