gazed / vu

Virtual Universe 3D Engine
BSD 2-Clause "Simplified" License
221 stars 26 forks source link

Implement Direct3D Renderer #4

Open gonutz opened 8 years ago

gonutz commented 8 years ago

There is a Direct3D9 wrapper here: https://github.com/gonutz/d3d9 Having a Direct3D renderer would make deployment on Windows easier, since Windows comes with DirectX drivers but usually has bad built-in OpenGL support and the average user usually is not inclined to or capable of updating their graphics drivers which often breaks something in a blue-screeny kind of way.

gazed commented 8 years ago

Wow! Nicely done! I completely agree that directX works better than opengl on Windows. Is Direct3D9 fixed pipeline? What do think about DirectX12 or Vulkan becoming the norm over the next 5 years or so?

gonutz commented 8 years ago

Thanks. Well in Direct3D9 you can choose to either use the fixed function pipeline OR use shaders and do everything yourself. I tend to go with shaders to have more control over what happens. On the subject of DirectX12, I have not looked into that much. My personal requirements for my mostly 2D games are met with D3D9 and it is supported by Windows XP and up so it is a nice requirement since basically all Windows machines meet it. I recently took a quick look at the Vulkan github repository (https://github.com/KhronosGroup/Vulkan-Docs) which has a formal XML file spec used to generate their C API. This is a very nice starting point to create a Go generator which would make it pretty easy to keep the Go wrapper up to date and I thought about creating such a generator when I get around to it. The way I created the D3D9 wrapper was by parsing MSDN, generating a basic Go wrapper and refining it manually but with Vulkan's XML spec this should be much quicker and less trouble. As for Vulkan becoming the norm I am very unsure about that. Microsoft will probably continue treating it as a second-class citizen as they have been with OpenGL and game developers will always have to support DirectX on Windows. So DirectX12, or any new DirectX version for that matter, will be the norm on Windows (95% of computers in the world) and I am afraid Vulkan will, for the foreseeable future, only be another buggy software path besides OpenGL and DX for game developer to support in their engines. For the next 10 years you will have to create 3 instead of 2 graphics paths and when OpenGL finally gets deprecated there will be 2 again. That is just my guess, maybe Vulkan's advantages will outweigh the work to support it but I am very sceptical of that. Still it is a nice API to play with and on Linux and Mac it may get up to speed more quickly.

On the subject of implementing the D3D9 path in your engine, I may get around to taking a look at your engine implementation and maybe start working on it. I can not promise anything, though, because my schedule is kind of busy right now.