Jump to content
  • Advertisement
Sign in to follow this  
GMX

OpenGL OpenGL vs. DirectX

This topic is 4187 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've heard different things when wondering whether to use DirectX for graphical programs or to use OpenGL. Some people have said that DirectX is more powerful/better but harder to use, is this true?

Share this post


Link to post
Share on other sites
Advertisement
This topic again?

http://www.google.com/search?q=opengl+vs+directx

and

http://tinyurl.com/3x6m7e (local search)

Search is a wonderful thing.

Summary? It is up to you, they can both more or less do the same things, and they do them in similar ways for the most part.

Share this post


Link to post
Share on other sites
This question springs up a lot and tends to lead to pointless arguments between different camps.

Firstly I'd better point out the more accurate comparison is between OpenGL and Direct3D. DirectX controls a lot more than just the graphics. That isn't necessarily a strike against OpenGL though, as with libraries such as SDL you can get a similar grade of functionality for most games.

I'm not an expert, but I've read a few of these debates. Basically I think the argument comes down to this:
  • If you are aiming for cross-platform games, use OpenGL
  • If you prefer C style procedural programming then OpenGL is more your flavour. If you prefer a more object oriented approach you might prefer Direct3D.
  • OpenGL may be slightly easier to get started in and draw things to the screen, but when you get deep into it then it's roughly the same.
  • If you are undecided about any of these and are developing for Windows it probably doesn't matter which one you choose. Once you are familiar with either OpenGL or Direct3D it's pretty easy to learn the other one.
  • Ideally once you get into a large project you'd write the code so it's not that dependent on what graphical interface you use, so you can easily swap between OpenGL or Direct3D or give your players the choice between the two

Share this post


Link to post
Share on other sites
I've worked with both, and OpenGL is a LOT easier to understand and start with. Direct3D is cool when you get it to work, but you got a lot to do before you get it to work like what you want.

But, Direct3D is a lot more powerful than OpenGL. I rarely see professional games in OpenGL, though OpenGL can be used in Linux as well.

I'm a very C style programmer, and only use OOP features when necessary. I also use Dev-C++, which is Linux based, instead of VC++, and OpenGL is the practially the only thing that works on it. This makes me exclusively OpenGL.

Now, I once tried Direct3D with VC++ and was impressed at what it can do, but ultimately I will never go back. It has too much overhead for me, and that constricts me too much. I'm just a 'weekend game programmer', so I'm not looking for flashy cool things. :)

Anyways, I'd say go with OpenGL, but if you want a real professional game, you must learn Direct3D someday. ;)

Share this post


Link to post
Share on other sites
hmmm... you signed up to post this, the most commonly asked question of all time. ( I think )

Troll?

Well, in any case, they're both pretty solid. Here's the first result from Google, that site has been known to have excellent articles. Personally I think its best to support both. There are so many cards and so many configurations out there, that who knows what kind of drivers / system setup your end-user will have. If you use an engine like OGRE, it will already include nearly identical support for both DirectX & OpenGL, so that your user can choose which to use and you can focus on other things.

Share this post


Link to post
Share on other sites
Quote:
Original post by sykosnakesix
I've worked with both, and OpenGL is a LOT easier to understand and start with. Direct3D is cool when you get it to work, but you got a lot to do before you get it to work like what you want.

But, Direct3D is a lot more powerful than OpenGL. I rarely see professional games in OpenGL, though OpenGL can be used in Linux as well.

I'm a very C style programmer, and only use OOP features when necessary. I also use Dev-C++, which is Linux based, instead of VC++, and OpenGL is the practially the only thing that works on it. This makes me exclusively OpenGL.

Now, I once tried Direct3D with VC++ and was impressed at what it can do, but ultimately I will never go back. It has too much overhead for me, and that constricts me too much. I'm just a 'weekend game programmer', so I'm not looking for flashy cool things. :)

Anyways, I'd say go with OpenGL, but if you want a real professional game, you must learn Direct3D someday. ;)


Odd, i thought doom3 was a professional game.

Also i still havn't seen a single feature in D3D that isn't avaliable in OpenGL. For any platform except Vista OpenGL is the only API that provides full access to the latest hardware. (And it will continue to be the case unless microsoft changes their mind about backporting DX10 to older windows versions , or updating D3D9 yet again.)

Ofcourse you might be refering to something else when you talk about power.

Share this post


Link to post
Share on other sites
I think the previous messages give some good advice. For whatever this is worth, I learned DirectX when I took a contract to create the game engine (and the guts of the first game) for a commercial game development company. So I guess it is reasonable to say I understood DirectX pretty well by the time the game was complete and released to market.

A few months ago I had to create the guts of a new 3D engine from scratch, which had to be based upon OpenGL for portability reason. Having gone through a painful learning curve with brand X, I was not thrilled to repeat the learning curve again with brand Y. Anyway, seeing your post made me think my experience might be helpful to your question. But remember, we all have different tastes and reasons for our preferences, so possibly your experience could be opposite mine.

The first week or so was definitely getting used to a new approach to 3D, which is to say, the way they work *is* different - or about as different as they can be given they end up being almost identical, functionally.

However, after the first week, everything thereafter was a major relief! It was like having a thorn removed after you kind of got used to the pain. For me, the difference is that significant. While I know some developers out there might be able to have exactly the opposite experience, it is actually difficult for me to believe it deep inside. Yet I know tastes *are* often that different.

Specifically, when working with the OpenGL API, I find my thinking process is about 3D, graphics, the architecture of my application, things like that. When I work with the DirectX API, I find my thinking process is often about finding or remembering or looking-up arbitrary details - the "how do I get done what I want). It feels like one extra unnecessary level of information to remember and cope with --- which almost seems to vanish with OpenGL.

That was my experience. Depending on your goals and your own preferences (likes and dislikes), your experience could be different, even opposite I suppose (even if that is difficult to imagine from inside my skull).

Oh, one important difference (mentioned by others) is not a matter of taste. If you think you'll ever be creating 3D applications for other platforms, you might want to choose OpenGL now - because then you won't need to subject yourself to a learning curve repeatedly like I did. Actually, it was three times for me (because the first 3D engine I wrote was 100% in my own code with no "helper" API beneath - just linear memory mapped onto the screen).

Good luck.

Share this post


Link to post
Share on other sites
If you are definately going to do Windown, Linux and OSX versions then OpenGL uis probably the easier route. Note the definately in that sentance, some dream about maybe one day along the line doing it shouldn't be a consideration imo.

That aside, honestly, give both a try and see which you prefer.
About the only real advantage D3D has right now over OpenGL for the new user is the SDK and related docs, they are pretty good and easy to get hold of.

One more consideration to throw into the mix; OpenGL is changing and soon.

I'm 99% sure that June will see the release of the new spec for OpenGL Longs Peak, this is a major change and while the old OpenGL2.x style programming will of course still work you might want to consider that you'll have to learn a reasonably different set of API functions afterwards to get the best from it.

I'm also given to believe there are some differences between D3D9 and D3D10 as well which means the same more or less applies there; however don't take my word on this as a definative answer as I'm a D3D9 newbie myself [grin]

Quote:

Original post by sykosnakesix
But, Direct3D is a lot more powerful than OpenGL.


This, is wrong.
Both OGL and D3D talk to the same hardware via the same drivers; effectively what one can do the other can do (there are small differences).

The reason why you see less OpenGL based commerical games is due to other factors; mostly based in what was going on in the OGL world a couple of years back based on the speed of OGL change and unresponsiveness of the ARB to change leading to what many termed 'extension hell' where vendor specific paths had to be taken to have access to the latest and greatest features. This has somewhat been fixed in the last couple of years.

As for games which use it; well anything based on the Quake or Doom engine series is ofcourse OpenGL based and I was surprised to find Homeworld 2 was (I knew Homeworld was), however you'd be right saying that many new commerical titles don't use it on Windows at least (WoW for example uses it on the Mac).

Share this post


Link to post
Share on other sites
I've not worked extensively with D3D on Win32 platforms, but I have on both Xbox and Xbox 360. My impression of it is that it has a C++ interface, but it's not exactly accurate to call it object oriented. It's really almost as procedural as OpenGL in practice.

The capability comparisons are mostly related to your platform and driver combo than the APIs themselves.

OpenGL's biggest strength and weakness is the "Open" part. It means that hardware manufacturers can add support for new features via extensions without the intervention of another company, but it also has historically meant that things can go for long periods of time without being standardized... leaving you in a situation where you have to implement the same feature in 2-3 different ways (using manufacturer extensions) because nothing has been standarized yet.

I don't know if this is a huge problem today, but it was a pretty big annoyance last time I did OpenGL development (shortly before OpenGL 2.0 was standarized).

So yeah, it really doesn't come down to one API being intrinsically better than the other. It comes down to which you prefer and which runs on the platforms you are targetting. (For all its portability, OpenGL isn't supported on a few significant commercial platforms.)

But this is always framed as a "versus" debate. So I'm going to make the audacious suggestion of learning and using both APIs.

Share this post


Link to post
Share on other sites
Quote:
Original post by exwonder
I've not worked extensively with D3D on Win32 platforms, but I have on both Xbox and Xbox 360. My impression of it is that it has a C++ interface, but it's not exactly accurate to call it object oriented. It's really almost as procedural as OpenGL in practice.

The capability comparisons are mostly related to your platform and driver combo than the APIs themselves.

OpenGL's biggest strength and weakness is the "Open" part. It means that hardware manufacturers can add support for new features via extensions without the intervention of another company, but it also has historically meant that things can go for long periods of time without being standardized... leaving you in a situation where you have to implement the same feature in 2-3 different ways (using manufacturer extensions) because nothing has been standarized yet.

I don't know if this is a huge problem today, but it was a pretty big annoyance last time I did OpenGL development (shortly before OpenGL 2.0 was standarized).

So yeah, it really doesn't come down to one API being intrinsically better than the other. It comes down to which you prefer and which runs on the platforms you are targetting. (For all its portability, OpenGL isn't supported on a few significant commercial platforms.)

But this is always framed as a "versus" debate. So I'm going to make the audacious suggestion of learning and using both APIs.


It is a bit better today, but i would still claim that OpenGLs main strengths are extensions and portability, and its greatest weakness is extensions.

Currently we can play with the G80 using nvidias extensions. (We could do that a few months before D3D10 was released even) , ATI/AMD doesn't seem to have any info regarding extensions for the r600 yet though. Thus we cannot know how big a problem it will be for this generation of cards.

The uncertainty is the biggest problem right now imo.
If i write a game in D3D10 i know it will run well on ATI:s next card without any modifications. If i write it in OpenGL using the new nvidia extensions i will possibly have to release a patch to get the same features on ATI hardware.

Ofcourse if i write it in OpenGL i get those features working in win2k/XP, aswell as non microsoft systems, but the number of users with G80:s running those systems are easily counted. (Mostly OpenGL developers who like to play with new shiny features as most gamers belive you need Vista to even use a G80)

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!