• Advertisement
Sign in to follow this  

In which technology should I invest: DirectX or OpenGL?

This topic is 3480 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 use Visual C++ as my development tool. I want to learn a low level graphics technology. Can you give me the pros and cons of using DirectX or OpenGL?

Share this post


Link to post
Share on other sites
Advertisement
Google would answer this, but what I did is flip a coin to decide what I learned first.

Share this post


Link to post
Share on other sites
Here are the basics:

If you want to make games that work on other operating systems that aren't Windows, use OpenGL.

If you have Vista, and don't mind limiting your game to other Vista users, you can use DirectX 10.

Otherwise, it doesn't really matter. OpenGL and DirectX talk to the same hardware. They are two different ways of doing the same thing. Some people find OpenGL quite easy to start off with, because it has an easy to use "immediate mode". However, when it comes to serious rendering, you will not be using this mode.

Share this post


Link to post
Share on other sites
This is a question that can't be answered easily. It is near-religious to be exact. The best way would be to check out both APIs (some code snippets, maybe some *good* tutorials ...) and then decide which API you like more.

Generally: You can't say XXX is faster than YYY. You can't say XXX is easier than YYY. You can't say XXX is better than YYY. You can only say that OpenGL is platform independent and DirectX is not. And you can say that DirectX is not only for 3D graphics and provides large and convenient helper libraries.

I personally prefer D3D thanks to its clear and mostly well-documented API.

Alexander

Share this post


Link to post
Share on other sites
Thanks for your advice. I have googled it, and in fact seems to be a matter of personal choice. I will look at both to see which one looks prettier.

Share this post


Link to post
Share on other sites
Quote:
Original post by hiigaraCan you give me the pros and cons of using DirectX or OpenGL?

No, because these kind of conversations tend to generate more heat than light. Fortunately you don't need my opinion, because searching the forums will reveal that this has been discussed literally hundreds of times. So have a read and be enlightened [smile]

Share this post


Link to post
Share on other sites
Quote:
Original post by hiigara
Thanks for your advice. I have googled it, and in fact seems to be a matter of personal choice. I will look at both to see which one looks prettier.


If you use non-Windows platforms, the choice is made for you.

Share this post


Link to post
Share on other sites
I don't use either, but based on what I've been reading and when I've dabbled in the past I would go for DirectX for the following reasons:


  • DirectX is near-as-dammit the absolute standard for Windows development. Seeing as most commercial games target Windows this seems to be a pretty profound requirement.

  • DirectX is continually being updated and improved, and has even been ported to two consoles (Xbox is derived from its original codename of DirectX-Box) and an MP3 player; the OpenGL crew have been bitching about OpenGL 3.0 forever now and OpenGL 2.0 is as old as the hills.

  • Further to the above, DirectX does appear in many places; the XNA framework Microsoft have issued for community-made Xbox 360 games is just a C# wrapper around DirectX

  • OpenGL only does graphics; DirectX includes much more than that (or at least it did, I'm behind the times)... it's like comparing apples and oranges. OpenGL does have addon libraries like GLUT but, again, these are as old as the hills and nobody really uses any of them commercially

  • You can use OpenGL with SDL, true. But it's pretty clumsy and all it enables you to do is easily create a window to draw in, all it saves you is the normal Win32 code required to spawn a window and draw to it in OpenGL mode

  • In my limited experience, I found DirectX much easier to use. It had better documentation, more resources available and better community support (although that's objective, the OpenGL community might claim otherwise)

  • Everyone will point you to the NeHe OpenGL tutorials; I don't want to sound rude but they really are useless, they're not put in context, they have limited comments and internal explanation and the code is pretty specific and geared to the specific demo he's showing you



I'm blinkered and only support Windows when I write code, so I would personally pick DirectX. If you're looking for a job in industry, though, knowing both or being in a position to learn the other after learning one would likely be beneficial to you, some really big studios write cross-platform games e.g. Unreal Tournament appears on Linux, and most iD games are OpenGL IIRC.

YMMV.

Share this post


Link to post
Share on other sites
I personally prefer OpenGL because (as others has said) it is only a graphical API, not to mention I prefer to develop for multiple platforms.

Even though the current OpenGL is older it is the same as Direct3D (DX9) in terms of power and ability. About the only thing that is going to truly affect your decision is whether you wish to also develop for anything other than Windows or want to get into OpenGL ES.

What is more important than the API is the concepts that go into graphical programming. The API is merely how you communicate with the GPU.

Share this post


Link to post
Share on other sites
Quote:

You can use OpenGL with SDL, true. But it's pretty clumsy and all it enables you to do is easily create a window to draw in, all it saves you is the normal Win32 code required to spawn a window and draw to it in OpenGL mode


You seriously underestimate SDL if that is what you think. I certainly wouldn't describe it as clumsy. I find SDL to work fantastic complement to everything OpenGL doesn't do.

Share this post


Link to post
Share on other sites
When this question is asked everybody boost OpenGL saying that it's cross-platform. I find it lame. The OP say he use VC++, that means he use Windows.
Which platforms does OpenGL support? Windows, Linux (X-Windows) and MacOS, maybe some handheld devices? That's not much, and from these choices Windows have more than 95% of the games. If you look at gaming consoles, most of them have their own graphic API (Sony, Nintendo) and the others use DirectX (Microsoft), so OpenGL is certainly not much used. I already been bashed, flamed and rated down here for saying that, but I still think the same way.

DirectX is well documented (MSDN), have a good SDK with samples, have good 3d and math libraries with it (who would need to be re-coded if using OpenGL) and provide a wonderful debugging help when used in conjunction with Visual Studio, thing that OpenGL don't have. Plus, I think some effects in DX10 (like geometry shaders) can't be used from OpenGL.

hiigara : If you use VC++ that probably means you have VC++6.0, which is old and very ugly. I suggest you to upgrade to VS2005 or VS2008 if you plan to do serious DirectX programming.

KodeNerd: You prefer OpenGL because it DON'T have libraries helping you? That's strange.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dunge
Plus, I think some effects in DX10 (like geometry shaders) can't be used from OpenGL.

Incorrect.

Share this post


Link to post
Share on other sites
Thx for clarifying that up, I googled and OpenGL extension do have these features.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dunge
Which platforms does OpenGL support? Windows, Linux (X-Windows) and MacOS, maybe some handheld devices?

_Many_ handheld devices use OpenGL, GL|ES to be precise. So OpenGL itself is not cross-plattform no. However the API is the same for a lot of different devices.

Quote:
Original post by Dunge
If you look at gaming consoles, most of them have their own graphic API (Sony, Nintendo) and the others use DirectX (Microsoft), so OpenGL is certainly not much used.

The others here being only the 360 (talking current-gen). As a matter of fact the Playstation 3 has a API based on GL|ES and i think the Wii has one as well.

Quote:
Original post by Dunge
DirectX is well documented (MSDN), have a good SDK with samples, have good 3d and math libraries with it (who would need to be re-coded if using OpenGL) and provide a wonderful debugging help when used in conjunction with Visual Studio, thing that OpenGL don't have. Plus, I think some effects in DX10 (like geometry shaders) can't be used from OpenGL.

The only valid point here is that OpenGL lacks math libraries. But this is by design. Anyways i don't think most professional games use the DX math libs, they probably roll their own.
And as Yann L said, geometry shaders can be used in OpengGL, and it does not require Vista.

Share this post


Link to post
Share on other sites
Quote:
When this question is asked everybody boost OpenGL saying that it's cross-platform. I find it lame. The OP say he use VC++, that means he use Windows.
Just because the OP states that he's using VC++ doesn't mean that he's not interested in cross-platform development, or won't become interested in cross-platform development in the future. As such, any discussion of which APIs are supported on which platforms is entirely relevant.
Quote:
Which platforms does OpenGL support? Windows, Linux (X-Windows) and MacOS, maybe some handheld devices? That's not much, and from these choices Windows have more than 95% of the games. If you look at gaming consoles, most of them have their own graphic API (Sony, Nintendo) and the others use DirectX (Microsoft), so OpenGL is certainly not much used. I already been bashed, flamed and rated down here for saying that, but I still think the same way.
You're entitled to your point of view, but realize that not everyone shares it. For example, some developers might consider it important (for whatever reason) to offer support for Linux and/or OS X.

Share this post


Link to post
Share on other sites
Quote:
Original post by lexs
The others here being only the 360 (talking current-gen). As a matter of fact the Playstation 3 has a API based on GL|ES and i think the Wii has one as well.
Ps3 supports OpenGL ES, but it's not the primary API. Most also say it's not a very good implementation either.

OpenGL also sometimes lacks good drivers on slightly older video cards. And from the manufacturer that has the most of the market share.

There isn't much different between either of them. Both of them are about filling up buffers and executing them, and writing shaders to do most everything else.

Share this post


Link to post
Share on other sites
Quote:
Original post by Daaark
Ps3 supports OpenGL ES, but it's not the primary API. Most also say it's not a very good implementation either.

I haven't heard anybody saying that it aint a good implementation, however people are saying that they are not using it because they get better performance with the lower level api, which is understandable.

Also, as i understand it, the 360 also has a lower level api. But i have no idea how many actually uses it.

Share this post


Link to post
Share on other sites
I have experience with PSP, NDS and Wii programming and I always used the manufacturer api, not OpenGL. I wasn't aware that PS3 support it, but as already said it's not the primary choice.

jyk: You have the mind that I try to understand. From my point of view you will learn OGL if either it's a personal choice or if you are hired to create a very specific program/game on a very specific device. If that happens, the person will already know what to use and won't come here to ask if DX is better. Sure Windows might not stay the primary used OS in the future, but at this point there will be something much better than DX and OGL... That said, I started learning 3D graphics using OGL many years ago and loved it.

Share this post


Link to post
Share on other sites
Quote:
Original post by lexs
I haven't heard anybody saying that it ain't a good implementation
It's written all over these boards.

Share this post


Link to post
Share on other sites
Ohh great somebody else rated me down for this thread.. I don't really care but seriously what the hell is wrong with you people? I think all of my discussion points are valid and rating people down just because you don't agree (or that you are using OGL since forever and are afraid to get up to date) is not really a wise thing to do.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dunge
Ohh great somebody else rated me down for this thread.. I don't really care but seriously what the hell is wrong with you people? I think all of my discussion points are valid and rating people down just because you don't agree (or that you are using OGL since forever and are afraid to get up to date) is not really a wise thing to do.
Happens all the time. At least this thread hasn't disintegrated into knee jerk reactions and name calling yet, like the other recent ones.

One of them works very well, has better docs and support, and works out of the box all the time. The other is a messy dinosaur, with a bunch of clumsy additions, and sometimes very bad drivers on cards that are just a few years old (and not made by nvidia or ati), but have a big share of the market.

But they can both get the job done, and they share the same ideas. You can move back and forth between them, because you do the same thing in each of them. They are two APIs to access the same hardware which differently named, but similar function calls.

It doesn't really matter which one you pick.

Share this post


Link to post
Share on other sites
Quote:
Original post by Antheus
Quote:
Original post by hiigara
Thanks for your advice. I have googled it, and in fact seems to be a matter of personal choice. I will look at both to see which one looks prettier.


If you use non-Windows platforms, the choice is made for you.


rated as unhelpful

say which "choice" is made next time. cryptic replies like these are pompous unfriendly and horribly frustrating for someone new to a topic. do not reply to this message.

Share this post


Link to post
Share on other sites
Quote:
Original post by sharpnova
rated as unhelpful


He did help that person by stating that his choice of API was already made (see below for an explanation of why what he said was perfectly fine).

Quote:
say which "choice" is made next time. cryptic replies like these are pompous unfriendly and horribly frustrating for someone new to a topic. do not reply to this message.


What he said was perfectly fine because people had already stated that OpenGL was cross-platform while DirectX is not.

Share this post


Link to post
Share on other sites
Quote:
Daark:
One of them works very well, has better docs and support, and works out of the box all the time. The other is a messy dinosaur, with a bunch of clumsy additions, and sometimes very bad drivers on cards that are just a few years old (and not made by nvidia or ati), but have a big share of the market.
I am reluctant to throw this point to beginners, who will inevitably not understand properly, and simplify to "OpenGL is bad, DirectX is good".

On the other hand, it feels like it would be remiss to not warn beginners of the developing mood wrt to OpenGL, 3.0, and the whole mess. To the extent that I am considering replying "use Direct3D, consider switching to OpenGL when you already have experience". It's such a wrong thing to say, yet...

Share this post


Link to post
Share on other sites
Quote:
Original post by oler1s
Quote:
Daark:
One of them works very well, has better docs and support, and works out of the box all the time. The other is a messy dinosaur, with a bunch of clumsy additions, and sometimes very bad drivers on cards that are just a few years old (and not made by nvidia or ati), but have a big share of the market.
I am reluctant to throw this point to beginners, who will inevitably not understand properly, and simplify to "OpenGL is bad, DirectX is good".

On the other hand, it feels like it would be remiss to not warn beginners of the developing mood wrt to OpenGL, 3.0, and the whole mess. To the extent that I am considering replying "use Direct3D, consider switching to OpenGL when you already have experience". It's such a wrong thing to say, yet...
Yep.

I just wish people could be more objective, and not have so much of an emotional attachment to an API.

Share this post


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

  • Advertisement