Sign in to follow this  
KaiserJohan

OpenGL Jumping over to DirectX?

Recommended Posts

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?

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites


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.

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites


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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this