Jump to content
  • Advertisement
Sign in to follow this  
ajmas

Why use D3D instead of OpenGL?

This topic is 4630 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have noticed a fair number of PC games these days use Direct3D instead of OpenGL. I would be curious to know what makes Direct3D more tempting than OpenGL for a games developer? Also, are there alternative cross-platform APIs that offer similar advantages as to those found in D3D? I don't intend for this to intend to turn into OpenGL is better than D3D type war, rather I would be interested in your reasons for choosing D3D over the alternative. Maybe links to indepth comparisons would be useful.

Share this post


Link to post
Share on other sites
Advertisement
I'm going to leave this open for now since it has a remote chance of staying reasonable and on-topic in this particular forum, but if anyone starts going off topic or ranting about the evils of a given API it'll be closed.

Anyways, to give one brief reason (which I posted with my closure of your lounge thread), the majority of games released for the PC are for windows and aren't intended to be ported to other PC platforms, so it doesn't really matter if they're harder to port. Also keep in mind that one of the most popular consoles out there (XBox) uses a version of DirectX.

Share this post


Link to post
Share on other sites
I use D3D for the D3DX library. It's massive, consistent, powerful, and already written and tested. What takes hours of glue coding in OpenGL is already built into D3DX. Sure there's libraries for a few things in OGL, but many of them are badly written, badly designed, or just generally strange...not to mention various licenses, leaving you to hunt down one that's actually acceptable.

Additionally, the managed libraries for DX are not merely a thin wrapper like Tao. They solve many of the core problems with D3D and overall lead to a much more structured architecture. So if I'm in a managed environment, I'll always prefer D3D.

Share this post


Link to post
Share on other sites
Check all the OpenGL/DX advantage and disadvantage/comparison charts. Then just ask yourself: "What do I want?", "What do I prefer", and use it. Just remember the obvious: if you want your game on Macs or Linux, use OpenGL.

On Windows, take your pick.

I, personally, use OpenGL. I have nothing against DX, I just use OpenGL, my preference.

EDIT: Yeah, look into wrappers too, depending on what your intentions are.

Share this post


Link to post
Share on other sites
For anyone who has touched on Java3D, does Direct3D play a similar role? Would it be considered to be at the same level or is D3D lower down. What I mean is that other than providing you with common functionality does it impose anything like a scene graph?

The reason I originally asked the question is simply to understand whether something like an OpenD3D would be worthwhile. For this to be the case Direct3D would need some sort of added value over the basic OpenGL, which it appears to do, given the replies so far. Has anyone attempted something of the sorts?

Share this post


Link to post
Share on other sites
Personally i use D3D because of its powerfulness, how its all easy to link to my appss, its advanced pre-builtin features like Pixel Shading and of course the main reason is because OpenGL is generally limited to 60fps. With that said i learnt OpenGL first and found it very easy to learn and yet still powerful, it is a great API for beginners and experienced programmers alike.

Share this post


Link to post
Share on other sites
Quote:
Original post by frupert
and of course the main reason is because OpenGL is generally limited to 60fps.


You definitely lost me there and made me go "what??". It's called vsync and not OpenGLs fault if certain vendors disable it per default for D3D but not for OpenGL in their drivers.

That said, I changed to D3D with version 8, when it stopped being a nightmarish waste of time. Enjoyed the luxury of having helper functions and libraries for almost everything, then made the fatal mistake of changing an app to version 9 when it came out. Then I decided I rather use my own or third party libraries and have an API that doesn't change half its interfaces with every version.

If you want all the extras and fast results (which I expect to be a major reason in commercial games) I'd suggest D3D, if you expect to insert the newest features during development and don't mind having to write/search a lot of libs for this and that I would use OpenGL. But in my opinion the answer to "why are most commercial games using D3D" is D3DX. So, when will we see a lib like that for OpenGL and give it a popularity boost?

Share this post


Link to post
Share on other sites
Right now I'm thinking about starting a project with friends and I'm wondering which API will be best for us so I'm giving a try at DirectX. We all know at least bits of OpenGL, I'm the only one that learned D3D, and even if we all know about one we are wondering which would be best. To help the decision between the two APIs I've decided to compare them... write a really simplified engine with a game (breakout clone), then I'll be able to see the difference. I haven't done the OpenGL version right now (I'm not finished with the DirectX one), but since I've had experience in OpenGL I can still make a quick comparison and/or give my observations.

I also like D3D because of the design which is "more" object compared to OpenGL where everything is global (many DirectX functions are global but many of the features are available in the interfaces). The interfaces found in DirectX helps me understand what I'm doing in other words, I prefer the device->SetTexture(...) way over the glBindTexture(...) way since I see on what object I'm working. This is not really something I'm goin to use in the decision because wrapper classes will do this trick quickly.

Also, DirectX seems to have the features implemented in it quickly and doesn't need some obscure extensions to load them. Over the years Microsoft really tried to get the game studios to choose their API and they implemented a lot of helper classes (like D3DX) and made a multimedia solution instead of only a graphic solution. DirectX seems better to me because of all what appears to be already there (like what is in D3DX) and that I won't have to deal with later (mostly extensions).

OpenGL is only a graphic library and DirectX is more like a multimedia library with input management (DirectInput). DirectX will also run on all PC running Windows and XBox, if you want more portability than that OpenGL seems to be the prefered way. Portability might be something good to have later, but not right now, we are aiming at PCs and want an API as complete as possible.

Also, since you have one "solution" for all that you don't have to worry about learning many obscure, baddly designed libraries or to deal with different licences. With DirectX, you deal with "one" thing (I mean that DX covers a lot more than GL) and it's available on all PC running Windows.

In the end, choosing between D3D or GL is choosing which you are more comfortable with and what will bring results faster. For me, choosing GL over DX would mean that I found a good helper library and a lib to deal with the extensions (or that want it to be portable), well designed and coded with a license compatible with what I'm doing (and free). Then I would probably make myself wrapper classes and make it the way I'd like to use it.


JFF

Share this post


Link to post
Share on other sites
This question tends to be asked quite a lot. The general idea between when to use either is simple. Some reasons you would want to use DirectX over OpenGL would be due to the fact that DirectX has many built in functions many of which handle mathematical operations. OpenGL is cross platform in that it can be used on Linux and Windows. DirectX tends to be mainly Windows and XBox orientated, there are ports to the Linux system but they are not quite well made.

OpenGL offers less mathematical functions its much more of a mathematical orientated API in my personal opinion and many will agree. You can do much more high complex things in DirectX, that require a lot more code in OpenGL but can be done in both. DirectX also utilizes COM, where OpenGL does not.

DirectX tends to be good for handling tasks in game programming where OpenGL is much more scientific.

Bottom line I see it is DirectX you can do many more complex things due it being very powerful, where in OpenGL you can do similar or the same, but it may require a lot more code that is already available in DirectX.

You can find more about them both on wikipedia:
OpenGL
DirectX

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
there is no need to change from ogl to d3d.

most people just choose one when they begin game-programming
and stick to it until the end of all days ;-)

the choice depends on what you want to do.

both are platform-independent.
d3d: windows, xbox xbox360
ogl: windows, linux (most distributions), mac

d3d has some things i like very much. especially the d3dx-functions.
allmost all drivers are prepared for d3d.
i cant say much about ogl, but i heard people complain about
the different librarys. some graphic cards may cause problems.

but many great games work with ogl quite fine, so it cant be that bad at all.


so i think both apis are good, you dont have to switch from one to another.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!