Jumping over to DirectX?

Started by
16 comments, last by 21st Century Moose 9 years, 9 months ago

I've done some progress on learning OpenGL (models, textures, lights, point light/directional cascaded shadow maps, deferred rendering with msaa) and I'm pondering whether to make the jump over to DirectX.

pros:

  1. API design. As my rendering pipeline gets more complex, structuring all the various state calls into something easily understandable yet fast gets increasingly annoying, especially under some form of OOP. Is this the case for DirectX aswell? Is there a big difference?
  2. Debugging tools. AFAIK, Visual studio has built in performance and debugging tools for directx, while doing the same for opengl has proven so far to be a nightmare. There is gDEbugger (and CodeXL) but they simply don't work/crash, probably something with the window framework I'm using (GLFW 3) and it's OpenGL context switches. I work in windows under Visual studio anyway, so tight integration with debugging tools seems too good to be true.

cons:

  1. Supporting frameworks. I'm using GLEW for loading OpenGL, GLFW 3 for window management and GLM for math stuff. I have to say they are some of the best libraries I have used; my main issue with jumping to DirectX would be that I would have to get equivalent frameworks for that, and some searching has yielded basically NOTHING.
  2. Tutorials/references. The majority of what I have found seems to be OpenGL focused - DirectX guides seems kinda lackluster. Is this true?

Anyone mind chiming in with some feedback?

Advertisement

my comments to your points:

pros:

1. True.. it's not easier and I don't think it'll make your code much more clean. But it has the advantage of having ONE way to do things, no more wondering where the fast path is. Using C++ also means slightly better error checking. No more glClear(GL_DEPTH).. oops.. i mean GL_DEPTH_BUFFER_BIT or whatever.

2. Sadly they killed PIX that was awesome. Visual Studio graphics debugger is a pain but still miles better than anything on OpenGL. Intel GPA is not bad too.

cons:

1. You dont need GLEW and GLFW.. that is why you don't find a "replacement".. that is a good thing in my book, to open a window, just open it the Win32 way. Also check out the new "modern C++" DirectX toolkit libraries on codeplex.. they replace the old D3DX11 libraries.. although some things are still very messy and unclear..ie. handling fullscreen. You can keep using GLM... although DirectXMath is way faster but much uglier.

2. I dont have the link but there are some good DX11 tutorials... official documentation and it also contains some tutorials.

All in all.. DX11 is a very good graphics API.. very well supported, great docs, good design, great drivers and stability, consistent shader compiler.. a big step forward if you are coming from OpenGL... it feels like it's actually 2014 and not 1999.

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni

Welcome to the dark side, young KaiserJohan. You’ve made the right choice. Glory and power will be yours.

There are more pros than what you listed.
In a talk about Longs Peak, NVidia and ATI (I believe) didn’t hold back on discussing why OpenGL needed Longs Peak. Since it didn’t get it, all those reasons still apply.
It’s not designed for games, its API is left-over cruft from a poor and non-game-focused initial design, they refuse to get rid of bind-to-edit and the state machine, etc.

And there are fewer cons than what you listed.
In fact, the tutorial scene is a major con of OpenGL. You never know if they are using deprecated cruft or modern techniques.
With Direct3D, there are plenty of samples already included in the SDK. Don’t bother searching, and feel comfort as you enjoy sample code that is not deprecated and specifically up-to-date for whatever version you choose.

Performance?
When I reconstructed my newest graphics library for my engine it started by just clearing the screen and drawing a single triangle.
Redundant state-changes all removed in all versions of the engine, just very bare-bones set-up.
OpenGL already performed less than 1 3rd of Direct3D 11 (and Direct3D 9 somewhere between).

Plus if it works on your Direct3D machine, it will work exactly the same (save performance) on all other Direct3D machines.

For what are you waiting?
Take my hand; I'll show you the wild side.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

You will get both side of the coin on this one..ultimately you will have to make the decision based on your experience with both. Without taking the plunge, you will never get a comprehensive unbiased evaluation of the two. I started out with DX 8.1 and continue throughout the years and the API has come a long way. DX used to be more forward thinking in terms of functionality, but there is parity between the 2 nowadays ( my opinion ). Currently, I'm leaning more to OpenGL because of its broad adoption across multiple devices and hardware configuration. The biggest gripe I have with DX now is the bonding of DX with OS ( need MS latest OS to use the latest DX features ). In the end they are both API to access the graphics HW for rendering/compute purposes.

For you pros and cons

Pro

1. DX is more structured that OpenGL and kudos to MS for giving that some thought. There are still different pipeline states to worry about, but again, the handling is much cleaner in DX.

2. Again, DX has the leg up on OpenGL for this one. I was a big fan of PIX ( RIP ), but there are plenty of tools out there for debugging D3D apps. The 2 that you mentioned on the OpenGL front are very good tools. I use CodeXL on a daily basis and the latest version is more stable. I also run AMD HW so I cannot comment on the stability on other HW, but it has been an invaluable tool to me. I've found 1 issue that causes it to crash/hang so avoid doing that, and so far so good.

Con:

1. As DX doesn't have an extension mechanism like OpenGL, there is not need for GLEW with DX. GLUT is a windowing utility toolkit thats tied to OpenGL so either you roll your own or use one of the may equivalent out there ex SDL. As GLM, there is nothing OpenGL inherent in math, the difference usually boils down to coordinate system convention, matrix storage layout etc..

2. The SDK documentation and samples ( installed with the SDK ) are very good and should be all you need to get your feet wet in DX.

#L.Spiro:

1. I would more likely say "welcome to light side". For me, the only strong argument why I'm using OpenGL in most of my applications is one - Linux (this counts especially when you're not developing games, but software for doing various high performance computations).

2. Comparing bare bones applications will show you larger difference in speed, than for case of F.e. full game. But generally yes, D3D will perform better.

#OP & thread generally:

I won't even mention debugging - under OpenGL we literally had to develop our own tools from scratch (they work well, but it took us hell a lot of time to create them).

Dealing with AMD vs NVidia vs any other vendor (and often driver versions) under OpenGL, with some recent features, is a bloody mess (I still remember moment, where one user of my applications had troubles with 3D textures and Intel gpu, that officially supported 3D textures extension (and also OpenGL version, where it was promoted into core), but once you sampled 3D texture inside shader, you were doomed.

So, as for me - go right away, switch to D3D.

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com

Small addition on tutorials/ learning DX11. You could buy the book '3D Game programming with DirectX11' by Frank D Luna), good learning curve and readability.

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

I'll just add that how easy D3D is going to be for you will depend very much on how you're currently using OpenGL. If you're used to modern OpenGL then you shouldn't have much problem translating the concepts over, but if you're still in glBegin/glEnd land you're likely to have an awful time.

If the latter is the case it may serve you better to do some research programs using modern OpenGL first, just to help you get a good understanding of the differences you're going to have to deal with when you port your main codebase (and to have that learning experience in a more familiar environment).

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

PROs:

- Better and really workin drivers (yes, if your application crashes, 99,8% its your fault, not a driver bug!)

- (Quite) Well Structured (sometimes too much) API

- Awesome tools and debuggers (PiX is dead, but there is a good replace in VS 2013, especially with Update 2 installed, and also IHVs tools are pretty good, even Crytek has a free DX debugger!).

- No more legacy code (only feature levels and some few cap-bits).

- No more extension hell.

- Few optional features.

CONs:

- You need to re-write your entire gfx API backend.

- The configuration of the pipeline the first times will made your head ache.

- Multi-threading is still a mirage (though with DX12 everything will change!) and driver command lists is a total failure (AMD cards don't even support them!)

- You can target only Windows NT6.x systems (Vista with platform update too).

- Direct3D 11.1 feature level 11_1 works only on Windows 8 and after, Direct3D 11.2 only on Windows 8.1 and after.

- Stallman will strike you with a fatwa.

..You asked for some tutorials, here we go:

First, never forgot MSDN library, it will be your best friend: http://msdn.microsoft.com/en-us/library/ee663274.aspx

The following covers the basis of the API, plus some intermediate and advanced topics (Microsoft SDK and samples):

- Braynzarsoft tutorials: http://www.braynzarsoft.net/index.php?p=DX11Lessons

- Rastertek tutorials (they are not the state of art at code and they use D3DX, but they cover many basic techniques and they are pretty easy to follow) http://www.rastertek.com/tutindex.html

- "Legacy and old" Microsoft DirectX SDK, covers DirectX9/10/11. Please note that libraries such the D3DX series and DXUT are no longer supported since Windows 8 SDK. http://www.microsoft.com/en-us/download/details.aspx?id=6812

- "Modern" (no more D3DX and DXUT) Microsoft DirectX samples: http://blogs.msdn.com/b/chuckw/archive/2013/09/20/directx-sdk-samples-catalog.aspx

The following are more advanced and specific techniques:

- AMD Radeon SDK: http://developer.amd.com/tools-and-sdks/graphics-development/graphics-development-sdks/amd-radeon-sdk/

- NVIDIA "legacy and old" SDK 11: https://developer.nvidia.com/dx11-samples

- NVIDIA "legacy and old" SDK 10 (convert from DirectX10 to DirectX11 is pretty easy): http://developer.download.nvidia.com/SDK/10.5/direct3d/samples.html

- NVIDIA "modern" DirectX SDK: https://developer.nvidia.com/gameworks-directx-samples

- Intel Visual Computing Source Samples: https://software.intel.com/en-us/vcsource/samples

Some useful replacement for D3DX and the old DXUT by Chuck Walbourn - MST:

https://directxmesh.codeplex.com/ for mesh data processing and optimization (new!)

https://directxtex.codeplex.com/ for texture processing.

https://directxtk.codeplex.com/ for everything else covered in D3DX, plus an audio API,sprite batch, effects management, simple math, models and more...

https://dxut.codeplex.com/ replace the old DXUT library.

https://fx11.codeplex.com/ replace the old effects library.

Other advanced, cool & useful stuff:

https://hieroglyph3.codeplex.com/ an entire DX11 framwork with cool stufs and Kinect by Jason Zink

https://mjp.codeplex.com/ MJP's stuffs like specular AA, bokeh and more..

https://tiledresources.codeplex.com/ Microsoft DirectX 11.2 Tiled Resources demo.

http://www.iryoku.com/ Jorge Jimenez works

GPGPU Pro series source code and samples from CRC Press (a good number of them are for DirectX11):

http://www.crcpress.com/product/isbn/9781568814728

http://www.crcpress.com/product/isbn/9781568817187

http://www.crcpress.com/product/isbn/9781439887820

http://www.crcpress.com/product/isbn/9781466567436

http://www.crcpress.com/product/isbn/9781482208634

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/


You could buy the book '3D Game programming with DirectX11' by Frank D Luna

That's a great book; far better than any online tutorial I've seen.

With one exception: Luna uses D3DX. kunos already mentioned the DirectX toolkit libraries; these should be used instead in new code.

Two remarks as an addition:
- PIX works fine with dx11 applications (if 32bit)
- the book uses both DirectxMath as D3DX, I think this shouldn't you from learning a lot from the book in a good readable way with doable learning curve (you can adapt other libraries when you encounter d3dx stuff while your going through the book)

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

This topic is closed to new replies.

Advertisement