c++winapiglfwhwnd

How to pass an HWND as a GLFWwindow*?


I have an HWND that I have been using as the target of OpenGL draw operations, and it is necessary that it be an HWND and not a GLFWwindow for other utilities of the application I'm making. The problem is, I need to load and use shaders on textures that I am rendering text to with FreeType. Unfortunately functions like glfwSetFramebufferSizeCallback() and glfwSwapBuffers() require a GLFWwindow*. Is there any way I can pass a normal HWND as a GLFWwindow?


Solution

  • "When in Rome"...

    Just leave your OpenGL window as GLFWwindow.

    When (if?) you really need HWND, use glfwGetWin32Window