Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


OpenGL vs DirectX


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

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

#1 3Ddreamer   Crossbones+   -  Reputation: 3159

Like
-2Likes
Like

Posted 19 September 2012 - 08:49 PM

Hi, everyone Posted Image


The reason why I am opening this discussion is because the information about these issues is so spread and muddled with opinions. My goal is to more centralize the subject of OpenGL and DirectX for convenience. Also given the blistering fast pace of both OpenGL and DirectX changes in games, I want the latest perspectives.

Both OpenGL and DirectX API based games and simulations, some switchable to either by the user, have been enjoyed and modded by me. Also a given is that both seem to be quite powerful and full featured, advantages and disadvantages for both.

Is OpenGL going to involve more advanced work for the game developer, yet greater flexibility in the long term? Doesn't the hardware accelerated 3D nature of OpenGL offer more potential for game features because software processing could be run simultaneously with hardware acceleration to broaden the game engine base - so to speak? Isn't hardware acceleration offering the most potential for game performance and more 3D objects and 2D textures allowable?


Clinton

Personal life and your private thoughts always effect your career. Research is the intellectual backbone of game development and the first order. Version Control is crucial for full management of applications and software.  The better the workflow pipeline, then the greater the potential output for a quality game.  Completing projects is the last but finest order.

 

by Clinton, 3Ddreamer


Sponsor:

#2 Radikalizm   Crossbones+   -  Reputation: 2940

Like
8Likes
Like

Posted 19 September 2012 - 09:07 PM

Oh boy, it's this discussion again...

Is OpenGL going to involve more advanced work for the game developer, yet greater flexibility in the long term? Doesn't the hardware accelerated 3D nature of OpenGL offer more potential for game features because software processing could be run simultaneously with hardware acceleration to broaden the game engine base - so to speak? Isn't hardware acceleration offering the most potential for game performance and more 3D objects and 2D textures allowable?


You are aware of the fact that both OpenGL and D3D are APIs for doing hardware accelerated rendering, right?
Also, what do you mean with 'more advanced work' when referring to OpenGL? Both APIs expose a similar set of features but do so in a different way, the flexibility or developer-friendliness of the two really depend on personal preference IMO.


I don't really get what you're asking here, both APIs are thoroughly documented so if you're trying to decide on which API to use I'd suggest you start digging through the available documentation.

I gets all your texture budgets!


#3 3Ddreamer   Crossbones+   -  Reputation: 3159

Like
0Likes
Like

Posted 19 September 2012 - 09:12 PM

Well, here is an example of the kind of contradiction that I read: Sources are publishing that DirectX is more software involved than hardware accellerated compared to OpenGL, but some such as yourself are not making the distinction, with all respect.


Clinton

Personal life and your private thoughts always effect your career. Research is the intellectual backbone of game development and the first order. Version Control is crucial for full management of applications and software.  The better the workflow pipeline, then the greater the potential output for a quality game.  Completing projects is the last but finest order.

 

by Clinton, 3Ddreamer


#4 Hodgman   Moderators   -  Reputation: 31076

Like
6Likes
Like

Posted 19 September 2012 - 09:28 PM

the hardware accelerated 3D nature of OpenGL

Both D3D and OGL are APIs for sending commands to a GPU (aka 3D hardware accelerator).
They both do the same thing, so it's mostly down to personal preferences as to which API you prefer. Some other factors besides API-style preference, are the platforms (OS's, drivers, GPU models) you want to support, and the support tools (Debuggers etc), that are available.

#5 Radikalizm   Crossbones+   -  Reputation: 2940

Like
0Likes
Like

Posted 19 September 2012 - 09:28 PM

And which sources would that be exactly?

You might be confusing some concepts here. When a graphics card does not support some features of the D3D API in hardware a so-called 'Reference Device' can be used by developers which emulates those features in software mostly for debugging purposes as a DX SDK installation is needed.
I believe a software renderer can also be used by D3D if you provide one, but it generally isn't recommended.

In normal situations Direct3D is a library for doing hardware accelerated rendering.

I gets all your texture budgets!


#6 3Ddreamer   Crossbones+   -  Reputation: 3159

Like
0Likes
Like

Posted 19 September 2012 - 09:36 PM

Okay, but isn't OpenGL more low level programming compared to DirectX? Isn't DirectX more friendly to scripting languages?


Clinton

Personal life and your private thoughts always effect your career. Research is the intellectual backbone of game development and the first order. Version Control is crucial for full management of applications and software.  The better the workflow pipeline, then the greater the potential output for a quality game.  Completing projects is the last but finest order.

 

by Clinton, 3Ddreamer


#7 Radikalizm   Crossbones+   -  Reputation: 2940

Like
2Likes
Like

Posted 19 September 2012 - 09:48 PM

Okay, but isn't OpenGL more low level programming compared to DirectX? Isn't DirectX more friendly to scripting languages?


Clinton


There's really no relation between scripting languages and either graphics API. It might be so that there are more wrappers for using DirectX in managed languages, I don't know, but this doesn't have anything to do with the DirectX library itself.

OpenGL is a procedural C API, while D3D is a more-or-less object-oriented API, there is no support for any scripting language out of the box for either API

I gets all your texture budgets!


#8 Hodgman   Moderators   -  Reputation: 31076

Like
6Likes
Like

Posted 20 September 2012 - 02:36 AM

Okay, but isn't OpenGL more low level programming compared to DirectX? Isn't DirectX more friendly to scripting languages?

No. They both operate at the same "level" and have no connection to scripting languages.
DirectX has a C++ API and OpenGL has a C API. Both are somewhat object-oriented in design, though obviously expressed differently (as C doesn't support OOP helpers, such as 'classes', so GL uses more object ID values instead, whereas D3D uses abstract base classes).

#9 Acharis   Crossbones+   -  Reputation: 3890

Like
0Likes
Like

Posted 20 September 2012 - 02:57 AM

It sounds that you perceive these APIs as completely different beasts. Actually, these are very, very similar. In the end both need to access the gfx card drivers that do the real work. There are differences, but these can be named best as "slightly". DX is considered slightly faster, slightly harder to learn, has slightly less problems with outdated drivers (and all of these points are contested by numerous people, so even at these you won't get a 100% agreement). I again stress the word "slightly". In the end it's mostly about convenience and personal taste of the coder...

The only big difference I can think of is that OpenGL is extremely crossplatform while DX is tied to MS platforms.

Europe1300.eu - Historical Realistic Medieval Sim (RELEASED!)


#10 SimonForsman   Crossbones+   -  Reputation: 6175

Like
0Likes
Like

Posted 20 September 2012 - 05:03 AM

Well, here is an example of the kind of contradiction that I read: Sources are publishing that DirectX is more software involved than hardware accellerated compared to OpenGL, but some such as yourself are not making the distinction, with all respect.


Clinton


Direct3D has a larger official support library(D3DX) Which is software only ofcourse but the hardware accelerated features are pretty much equivalent. (OpenGL doesn't have any official software support library anymore, (glu and glaux are software support libraries for OpenGL but both are deprecated and horribly out of date) There are tons of third party support libraries to choose from though if you want and Microsoft is deprecating most of its support library for DX with Windows 8, (Pretty much noone uses it for professional games anyway and since the two APIs have become so similar most of the third party support libraries work just fine with both APIs)
I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#11 Zouflain   Members   -  Reputation: 532

Like
2Likes
Like

Posted 20 September 2012 - 06:54 AM

I'll preface this by saying I am (almost) exclusively an OpenGL user. I found DirectX cumbersome, as I tried to learn it simultaneously with C++ - this was out of a 10 year old book, so I imagine it was something like DX7 and a lot less streamlined. OpenGL automagically worked for me at the time, so I never honestly looked back. I still kept up with research, however. Ironically, this automagic property of OpenGL has almost universally been deprecated, but I digress.

The reason why I am opening this discussion is because the information about these issues is so spread and muddled with opinions. My goal is to more centralize the subject of OpenGL and DirectX for convenience. Also given the blistering fast pace of both OpenGL and DirectX changes in games, I want the latest perspectives.

Besides choosing one API over the other due to being unable to use the other (say, D3D for working with your favorite engine, or OpenGL for a wii game) there is no objective means of choosing one or the other, and so all you can ever hope to get is a wide spread and opinion muddled set of responses. I can say that most major game developers favor D3D because it's the traditional API that has been in use for quite some time. Familiarizing yourself with it from a professional game development standpoint is a wise decision... but OpenGL targets dozens of platforms, whereas D3D is quite limited. If you care at all about portability, D3D becomes a very poor choice.

Is OpenGL going to involve more advanced work for the game developer, yet greater flexibility in the long term?

Arguably. OpenGL is very minimalist, especially since 3.1. There are several "handy dandy" things that it simply does not do for you the way D3D does. It's still just as capable of doing them, but OpenGL does not define a default way of doing it (copying a texture to a texture, for instance, requires you to use framebuffers or pixelbuffers - the closest thing, glCopyTexImage2D, draws from the bound buffer) nor is the ARB interested in adding many convenience features. The difference in difficulty between D3D and OpenGL in this regard boils down to an occasional dozen or so lines of code. Not much, but "arguably" more.

It is also arguably more flexible, but only in that it is significantly more portable. Writing linux or mac games in D3D instantly makes WINE necessary at a cost to FPS (as WINE must redirect D3D calls to OpenGL), and I'm not sure if the Wii and PS3 support D3D at all. But while they had significant differences in the past, now they're both effectively equivalent in features. Games using one API do not suffer graphically over another - however, some designers may prefer the "style" or "approach" one API uses over the other, and like me, find it annoying to use the conflicting style.

Doesn't the hardware accelerated 3D nature of OpenGL offer more potential for game features because software processing could be run simultaneously with hardware acceleration to broaden the game engine base - so to speak? Isn't hardware acceleration offering the most potential for game performance and more 3D objects and 2D textures allowable?

They're both hardware accelerated, and most often have very close benchmarks. One might outperform the other at some specific operation or other, but overall there is no speed advantage to either. This is not an advantage for OpenGL.

Three questions answer which API to use:
--Looking to be familiar with rendering schemes of major AAA titles ? DirectX : Either //neither is better, but traditionally D3D is used. OpenGL is also used, but much less.
--portability matters ? OpenGL : Either //DirectX has no portability
--Prefer OpenGL Style ? OpenGL : DirectX //Purely your opinion

Remember, however, that DirectX is more than D3D. If for whatever reason you hate all DirectSound alternatives (FMOD, OpenAL, ect) or DirectInput alternatives, then DirectX trumps OpenGL by virtue of your project already using it elsewhere.

#12 Hodgman   Moderators   -  Reputation: 31076

Like
3Likes
Like

Posted 20 September 2012 - 07:44 AM

It is also arguably more flexible, but only in that it is significantly more portable. Writing linux or mac games in D3D instantly makes WINE necessary at a cost to FPS (as WINE must redirect D3D calls to OpenGL), and I'm not sure if the Wii and PS3 support D3D at all.

Wii uses a proprietary API (similarly designed to GL) called GX, and the PS3 has a proprietary API called GCM, which is much more low level than GL or D3D. The PS3 also has a wrapper called PSGL, but this is different to "Desktop GL" and is a translation layer (like Wine's D3D->GL layer). The 360 has a proprietary API that's quite similar to D3D9.

IMHO, the portability of OpenGL is a bit of a red herring.
On Windows/Linux, the OpenGL runtime is almost entierly implemented by your graphics driver, and there is no governing authority to ensure standards compliance -- it's industry self policing only. This means that vendors can and do violate the standard in ways to hurt each other -- e.g. nVidia drivers accept HLSL syntax in GLSL shaders, with the hopes that developers may ship such shaders, which will appear broken on ATI/Intel GPUs...
On the other hand, Apple keeps a much tighter grip on things (like Microsoft does with D3D), so OpenGL on Apple OS's is going to be a lot more reliable.
So the 3 platforms that GL gives you portability to -- Linux/Windows and Apple -- all actually may behave slightly differently. You still need to test your renderer separately on each platform, and on Windows/Linux, you also need to test your renderer on GPUs from each manufacturer, as each of these tests is against a completely different implementation of the OpenGL runtimes.

Also, if you want to support the latest SM5 GPU features, but also support scaled-down versions of your renderer for SM4 and SM3 GPUs, then you've still got to "port" a lot of your rendering code no matter the API.
On Windows with D3D, you'd have to maintain a D3D11, D3D11_feature_level_10 and a D3D9 version of your renderer.
With GL, you'd have to maintain a GL2, GL3 and GL4 version of your renderer.

So a "cross platform" renderer has to maintain and test code for:
Consoles: GX + GCM + "D3D360" + any other consoles
Mac: GL2 + GL3 + GL4 [edit]SM5 level GPUs not supported by apple[/edit]
Linux: GL2 + GL3 + GL4 multiplied with ATI + nVidia + Intel
Windows plan A: GL2 + GL3 + GL4 multiplied with ATI + nVidia + Intel
Windows plan B: D3D9, D3D11_10, D3D11
Mobile Phone: GLES1 + GLES2 multiplied with each Android + iOS device

Yes, sharing common GL code paths might be able to save you some time, but no matter which APIs you use, it's going to be a hell of a lot of work.

Edited by Hodgman, 20 September 2012 - 09:22 AM.


#13 SuperVGA   Members   -  Reputation: 1118

Like
1Likes
Like

Posted 20 September 2012 - 08:45 AM

glu and glaux are software support libraries for OpenGL but both are deprecated and horribly out of date.

Yeah, that's true, and sure they're not officially supported but freeglut and glee are nice extensions.
I use them both everyday, and they're updated quite often...

#14 SimonForsman   Crossbones+   -  Reputation: 6175

Like
1Likes
Like

Posted 20 September 2012 - 08:59 AM

So a "cross platform" renderer has to maintain and test code for:
Consoles: GX + GCM + "D3D360" + any other consoles
Mac: GL2 + GL3 + GL4
Linux: GL2 + GL3 + GL4 multiplied with ATI + nVidia + Intel
Windows plan A: GL2 + GL3 + GL4 multiplied with ATI + nVidia + Intel
Windows plan B: D3D9, D3D11_10, D3D11
Mobile Phone: GLES1 + GLES2 multiplied with each Android + iOS device

Yes, sharing common GL code paths might be able to save you some time, but no matter which APIs you use, it's going to be a hell of a lot of work.


When did Apple add OpenGL4 support ? (Last time i checked they had just added OpenGL 3.2 in Lion and i don't think Mountain Lion added anything new in that area). (Apples tight grip might keep things consistent but they do lag behind quite a bit when it comes to supporting new features)
I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#15 freakchild   Members   -  Reputation: 557

Like
1Likes
Like

Posted 20 September 2012 - 01:03 PM

Neither are bad and both have matured well enough, appropriately and look to be continuing to do that. If the platforms you're targeting don't force the decision somewhat, then I'd look into both and make a personal decision based on preference. I'd also say that if you have the time, consider doing both anyway...your own software architecture will be much stronger when based on concepts supportive of both targets.

So...find a reason to rule one or the other out (such as platforms) and make the decision easy for yourself if possible, if that's not an option try both and make a personal decision and if you can afford the time and effort, do both, or at least do one in full and keep your hand in the other anyway.

Either way, never say never. I did that and was never a fan of Mac's, so if five years ago someone was to suggest to me that I'd have spent last year on Open GL ES doing mobile and this year on Open GL 3.2 and Mac, I'd have thought they were on crack yet it's been surprisingly good fun. The Mac is a fairly decent platform for OpenGL development actually.

Direct3D or OpenGL...you'll have good fun on either or both paths regardless.

Edited by freakchild, 20 September 2012 - 01:26 PM.


#16 mhagain   Crossbones+   -  Reputation: 8140

Like
1Likes
Like

Posted 20 September 2012 - 07:32 PM

They both work, they're both good, they're both fun to use, so choose either but in the longer term aim to learn both.

Doesn't the hardware accelerated 3D nature of OpenGL offer more potential for game features because software processing could be run simultaneously with hardware acceleration to broaden the game engine base - so to speak? Isn't hardware acceleration offering the most potential for game performance and more 3D objects and 2D textures allowable?

Okay, but isn't OpenGL more low level programming compared to DirectX? Isn't DirectX more friendly to scripting languages?


You seem to have some very suspect sources here. As pointed out above, both are hardware accelerated, and both are very low-level (OpenGL is actually a little higher-level than D3D as it abstracts some hardware concepts a little more; I suspect that whatever sources you're using may not have updated their info since sometime around 1996 or 97...)

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.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS