Jump to content

  • Log In with Google      Sign In   
  • Create Account


Jumping over to DirectX?

  • You cannot reply to this topic
17 replies to this topic

#1 KaiserJohan   Members   -  Reputation: 1029

Like
0Likes
Like

Posted 23 June 2014 - 08:46 AM

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?

 



Sponsor:

#2 kunos   Crossbones+   -  Reputation: 2185

Like
6Likes
Like

Posted 23 June 2014 - 09:02 AM

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
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#3 L. Spiro   Crossbones+   -  Reputation: 12240

Like
6Likes
Like

Posted 23 June 2014 - 10:33 AM

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
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#4 cgrant   Members   -  Reputation: 538

Like
-1Likes
Like

Posted 23 June 2014 - 12:33 PM

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.



#5 Vilem Otte   Crossbones+   -  Reputation: 1347

Like
0Likes
Like

Posted 23 June 2014 - 01:04 PM

#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.


Edited by Vilem Otte, 23 June 2014 - 01:05 PM.

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


#6 cozzie   Members   -  Reputation: 1463

Like
0Likes
Like

Posted 23 June 2014 - 01:41 PM

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.



#7 mhagain   Crossbones+   -  Reputation: 7436

Like
0Likes
Like

Posted 23 June 2014 - 05:23 PM

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).


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#8 Alessio1989   Members   -  Reputation: 1663

Like
8Likes
Like

Posted 23 June 2014 - 07:53 PM

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


Edited by Alessio1989, 25 June 2014 - 11:36 AM.


#9 cdoubleplusgood   Members   -  Reputation: 793

Like
0Likes
Like

Posted 24 June 2014 - 03:16 AM


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.



#10 cozzie   Members   -  Reputation: 1463

Like
0Likes
Like

Posted 24 June 2014 - 03:31 AM

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)

#11 WriterOfAlicrow   Members   -  Reputation: 113

Like
-5Likes
Like

Posted 24 June 2014 - 12:56 PM

Please stay away from Direct3D!!

 

I can't speak for the API design or any of that, but Direct3D is only available for one platform. (As I understand it, the XBox version is actually a different API). If you learn Direct3D, and later decide that you want to target Linux, OS X, Android, iOS, PlayStation, et cetera, then you'll need to go back to OpenGL.

 

Right now, I guess you're only concerned about Windows. But think about 5, 10 years from now. Windows is the most popular OS because people are used to it, and developers don't bother to target other platforms. That's changing. College students are picking up OS X and finding it to be a smoother experience. Nerdy, curious developers like myself are installing Linux on an old computer or in a virtual machine, and finding out how much freedom it provides (you don't need to alter any source code, just change settings). Windows is on the decline.

 

Plus, there's the whole mobile device thing. You want into that market, and you need to know OpenGL ES.

 

If you really think that Direct3D offers enough benefits to warrant learning it, go ahead. But first, do yourself a favor: try Linux. Install it in a virtual machine, or an old computer, or set up a dual-boot on your current computer. Experiment a little. Try to find the right desktop environment for yourself. If it turns out you like GNOME, or KDE, or Unity, or one of the other thousands of desktop environments (just try five or so, not all of them) better than what you get with Windows, then it's better you find that out before you devote a bunch of time to learning an API that won't work on other platforms.

 

I used to use Windows, and I couldn't understand why anyone would bother to use anything else. But once I tried Linux, I realized that I'll never again be satisfied with an OS that forces me to pay for every new version, requires anti-virus, hogs my system resources, and won't let me customize things.

 

All I'm asking is that before you jump to a proprietary, single-platform, can't-get-the-latest-features-without-buying-a-new-OS-that-you-may-hate API, you make sure you're okay with only ever releasing games for that platform.

 

Sorry for the rant about the awesomeness of Linux. I just think that--especially with SteamOS--you need to take it into account.



#12 phantom   Moderators   -  Reputation: 6791

Like
6Likes
Like

Posted 24 June 2014 - 01:46 PM

If you learn Direct3D, and later decide that you want to target Linux, OS X, Android, iOS, PlayStation, et cetera, then you'll need to go back to OpenGL.


Meanwhile in reality...

1) D3D11 serves Windows
1.1) Until D3D12 comes along, platforms unknowns
1.2) Maybe Mantle too for AMD specific paths
2) D3D11+ serves Xbox One
2.1) and it'll probably get a flavour of D3D12
3) PS4 requires Gnm
4) OS X is stuck in the low 4.1 OpenGL support so no modern features for you
5) Linux uses OpenGL but driver support remains spotty
6) Android is a hateful OS and you'll be writing hardware specific hacks and workarounds until the cows come home
7) iOS is basically going Metal
7.1) unless you want pre-8.0 devices too then you'll need Apple Flavoured GL|ES too

The reality is that to cover the platforms you listed and then some you'll need more than one backend anyway, OpenGL is not (and never has been) the answer to all graphics programming woes. On Windows alone once you get outside of NV land things become more and more patchy, and that's not counting things NV's tendency to do what they think is right vs the spec which trips people up.

The ONLY reason I'm considering spinning up an OpenGL backend for my game over a D3D11 one is because it gives me access to some features which future APIs will have but currently don't expose and in the time line of my game idea those new APIs will be around before I ship.
(Also I've got a few years experience working on rendering for AAA games so I figure I'm experienced enough to figure out wtf is going on when things break... and they will...)

Edited by phantom, 24 June 2014 - 02:21 PM.


#13 mhagain   Crossbones+   -  Reputation: 7436

Like
5Likes
Like

Posted 24 June 2014 - 02:24 PM

Please stay away from Direct3D!!

 

I can't speak for the API design or any of that, but Direct3D is only available for one platform. (As I understand it, the XBox version is actually a different API). If you learn Direct3D, and later decide that you want to target Linux, OS X, Android, iOS, PlayStation, et cetera, then you'll need to go back to OpenGL.

 

Right now, I guess you're only concerned about Windows. But think about 5, 10 years from now. Windows is the most popular OS because people are used to it, and developers don't bother to target other platforms. That's changing. College students are picking up OS X and finding it to be a smoother experience. Nerdy, curious developers like myself are installing Linux on an old computer or in a virtual machine, and finding out how much freedom it provides (you don't need to alter any source code, just change settings). Windows is on the decline.

 

Plus, there's the whole mobile device thing. You want into that market, and you need to know OpenGL ES.

 

If you really think that Direct3D offers enough benefits to warrant learning it, go ahead. But first, do yourself a favor: try Linux. Install it in a virtual machine, or an old computer, or set up a dual-boot on your current computer. Experiment a little. Try to find the right desktop environment for yourself. If it turns out you like GNOME, or KDE, or Unity, or one of the other thousands of desktop environments (just try five or so, not all of them) better than what you get with Windows, then it's better you find that out before you devote a bunch of time to learning an API that won't work on other platforms.

 

I used to use Windows, and I couldn't understand why anyone would bother to use anything else. But once I tried Linux, I realized that I'll never again be satisfied with an OS that forces me to pay for every new version, requires anti-virus, hogs my system resources, and won't let me customize things.

 

All I'm asking is that before you jump to a proprietary, single-platform, can't-get-the-latest-features-without-buying-a-new-OS-that-you-may-hate API, you make sure you're okay with only ever releasing games for that platform.

 

Sorry for the rant about the awesomeness of Linux. I just think that--especially with SteamOS--you need to take it into account.

 

Nice "sales pitch", but if you check out post #5 you'll see that Linux is already a target platform for the OP.  In spite of which he's still talking about jumping to D3D.

 

Just to re-emphasise phantom's post, the mobile platforms use OpenGL ES (which, like that for 360, is actually a different API) - strike one.  The Playstation 3 offered PSGL which nobody used - strike two.  Smart money seems to be on Apple ditching OpenGL on OS X in the near-to-medium future too - strike three.

 

"Only ever releasing games for that platform" - what a silly thing to say.  Why not write a renderer that supports both OpenGL and D3D?

 

Frankly, this focus on OpenGL as a magic ingredient that suddenly makes your game multiplatform is completely bogus.  Is OpenGL going to make your networking code multiplatform?  Is it going to make your sound code multiplatform?  Is it going to make your input code multiplatform?  You're already writing to platform-specific APIs for these, rendering is not a special case.


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#14 WriterOfAlicrow   Members   -  Reputation: 113

Like
-6Likes
Like

Posted 24 June 2014 - 06:24 PM

Well, sorry for offering my opinion and advice. I can see I'm not welcome here. Please continue misinterpreting my post and upvoting everyone who acts like a jerk towards me. Seriously. Knock yourself out. I'm used to being treated like crap for having a different opinion.



#15 L. Spiro   Crossbones+   -  Reputation: 12240

Like
3Likes
Like

Posted 24 June 2014 - 07:37 PM

You will find that throwing yourself public pity parties is shunned as much as providing heavily biased opinions as fact or even more.
Instead of shifting blame, you should consider why you were so down-voted in the first place, man up, and take steps to fix it in the future.

 

 

L. Spiro


It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#16 SeraphLance   Members   -  Reputation: 1277

Like
0Likes
Like

Posted 24 June 2014 - 10:51 PM


4) OS X is stuck in the low 4.1 OpenGL support so no modern features for you

 

My GPU (GTS 250), old as it is, can still run 95% of the triple-A games on PC, and it only supports up to OpenGL 3.3.  If you're targeting above 4.1 for "modern features", things like platform choice no longer matter because you don't really have a platform at that point unless you don't want to release for another 5 years.



#17 phantom   Moderators   -  Reputation: 6791

Like
1Likes
Like

Posted 25 June 2014 - 02:12 AM

The prevailing direction is towards heavy compute based architectures which, yes, requires two rendering paths anyway ("legacy" and "compute") if you want to cover old hardware however in the AAA space at least pre-11 hardware is becoming less of a focus so your 95% will drop off pretty quickly now.

More to the point if you are working on something now then your release window is likely to be a couple of years away so saying "well, this is good enough now.." gets you no where. (A release window of less than that probably requires an existing engine, either in house or purchased, so the choice of renderer backend is already fixed either for the initial target or whatever the purchased engine supports).

Either way, Apple have shown no interest in updating OpenGL support on OSX and, despite the hardware being able to, do not support compute shaders (beyond other things) which is a major issue for many people.

Regardless pre-DX11 class hardware is yet another render path, regardless of platform or API.

#18 mhagain   Crossbones+   -  Reputation: 7436

Like
1Likes
Like

Posted 25 June 2014 - 02:48 AM

Well, sorry for offering my opinion and advice. I can see I'm not welcome here. Please continue misinterpreting my post and upvoting everyone who acts like a jerk towards me. Seriously. Knock yourself out. I'm used to being treated like crap for having a different opinion.

 

You wrote:

 

 

Right now, I guess you're only concerned about Windows

 

But yet the OP had already stated (in post #5) that Linux is currently a target platform.

 

You wrote:

 

 

If you learn Direct3D, and later decide that you want to target Linux, OS X, Android, iOS, PlayStation, et cetera, then you'll need to go back to OpenGL

 

And that's as scurillous as the infamous Wolfire blog post because most of those platforms don't actually use OpenGL (best of luck trying to port desktop GL code to GL ES).

 

Frankly, I could go on here but what's the point?  This isn't "opinion and advice", this is misinformation.  There's nothing wrong with giving opinion provided you've got facts to back it up, and in this case you don't - you are in fact just giving a sales-pitch for Linux to someone who was already targetting it anyway, and using false information to support that sales-pitch.

 

That's why you were downvoted.


Edited by mhagain, 25 June 2014 - 04:58 AM.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.






PARTNERS