Direct3D 9/11 support for GLFW 3

expandable wrote on Tuesday, February 21, 2012:

Hello everyone,

I am currently annoyed by the fact that there are no window frameworks such as
GLFW that support both OpenGL and Direct3D (do you know of one?). I am
therefore considering to add D3D9/11 support to GLFW. Would anyone be
interested in that? I’d be happy to contribute the changes back to the GLFW
team so that they can include the D3D support in the official releases.

Of course, D3D support would be Windows-only. My idea is to provide new window
hints to choose between D3D9 and D3D11 (+ features levels in the latter
case). On non-Windows OSes, specifying such a window hint would either
generate an error or just get ignored. We would also need a new function
(only available in Windows builds) that would return some D3D-objects
(device, swap chain, …)

Let me know what you think!

elmindreda wrote on Thursday, February 23, 2012:

Thank you for you offer.

The idea of GLFW is to provide a platform-independent API for OpenGL
development. Adding support for Direct3D would make it neither platform-
independent nor focused on OpenGL. As such, I believe this is a bad fit for

However, please do use any part of GLFW you find useful for creating such a

marcel_metz wrote on Thursday, February 23, 2012:

Hello Axel,

I would like to point out that there is a library called DXUT that is part of
the DirectX SDK and provides similar capabilities like GLFW or GLUT. Maybe
this is a better fit for your requirements than adding a complete different
rendering API to GLFW.



expandable wrote on Friday, February 24, 2012:

Thank you for your feedback.

I understand GLFW’s focus on OpenGL and platform-independence and while adding
D3D support wouldn’t make it less cross-platform in general, it would add some
Windows-only functionality. I am aware of DXUT, and as a matter of fact, I’ve
been using it for quite some time, but the problem is that there is no
consistent APIs for both libraries (i.e., input handling is different and so

Anyway, based on your feedback I’ll most likely write a small wrapper library
around GLFW and DXUT. That should be fast do to and serve my needs perfectly.

Thanks for your great work on GLFW!

sxtheone wrote on Wednesday, June 26, 2013:


I’m searching exactly what you wanted to create! I want to use ORX game engine what uses GLFW and the publisher said that they REALLY prefer directX-based games… So, my question is that have you been succeeded in ‘merging’ the two APIs? I would be very much interested if you are willing to share your results.