浏览代码

Add GLFW error handler to show error messages, hopefully gives more descriptive errors (hopefully helps #149)

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
Alexis Maiquez 3 年之前
父节点
当前提交
847cd56ddf
共有 1 个文件被更改,包括 7 次插入 和 0 次删除
  1. 7 0
      src/WallpaperEngine/Render/Drivers/COpenGLDriver.cpp

+ 7 - 0
src/WallpaperEngine/Render/Drivers/COpenGLDriver.cpp

@@ -4,9 +4,16 @@
 
 using namespace WallpaperEngine::Render::Drivers;
 
+void CustomGLFWErrorHandler (int errorCode, const char* reason)
+{
+	sLog.error ("GLFW error ", errorCode, ": ", reason);
+}
+
 COpenGLDriver::COpenGLDriver (const char* windowTitle) :
     m_frameCounter (0)
 {
+	glfwSetErrorCallback (CustomGLFWErrorHandler);
+
     // initialize glfw
     if (glfwInit () == GLFW_FALSE)
         sLog.exception ("Failed to initialize glfw");