Sign in to follow this  
superjaws

OpenGl or DirectX?

Recommended Posts

superjaws    115
Whats the differences between OpenGl and DirectX cause I'm going through books to buy and I was wondering which would be more beneficial for me to learn?

Share this post


Link to post
Share on other sites
Boder    938
OpenGL is more cross-platform
DirectX has very good documentation
OpenGL is easier to use in C
DirectX includes DirectInput, DirectSound, Direct3D
The DirectX SDK is big, but it comes with documentation, samples, tools
DirectX makes use of more advanced concepts like COM, double pointers

Share this post


Link to post
Share on other sites
Ezbez    1164
Quote:
Original post by Boder
DirectX has very good documentation


OpenGL has alot of documentation, too. Mabye not as good, though, but still very good.

You'll probably want DirectX if you're only using Windows and aren't planning on switching to anything else anytime soon. Use OpenGL if you want it cross-platform. That is, excluding the fact that OpenGL is *only* graphics, the largest difference between them.

Share this post


Link to post
Share on other sites
jollyjeffers    1570
Quote:
Original post by superjaws
Whats the differences between OpenGl and DirectX cause I'm going through books to buy and I was wondering which would be more beneficial for me to learn?
Without more context it's difficult for you or anyone else to answer this question.

What sort of projects do you want to work on? Purely games, (scientific) visualisation, general graphics?

Is it for your own personal amusement, or do you want to (eventually) sell any games you make?

Which of MS Windows, Linux or MacOS your "home" Operating System?

[flaming] Purely opinion of course, but I recently read a few comments (connected to that flame-fest around Vista and OpenGL) stating that Direct3D had won the "gaming" arena but OpenGL was still the king in the CAD/Modelling/Art/Scientific community. YMMV.

Jack

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Quote:
Original post by Boder
OpenGL is more cross-platform
DirectX has very good documentation
OpenGL is easier to use in C
DirectX includes DirectInput, DirectSound, Direct3D
The DirectX SDK is big, but it comes with documentation, samples, tools
DirectX makes use of more advanced concepts like COM, double pointers


In another words, DirectX is as professional as you're going to get. In the business, I'd expect you to know both at the end, but the games on the market seems to suggest that DirectX is the better way to go for starters. Only those without a job right now would suggest otherwise.

Share this post


Link to post
Share on other sites
Dorvo    272
I'd have to agree with tha' Foo. I found OpenGL a lot easier to learn than DirectX. And you will want to eventually learn them both. But, if you use one to learn the techniques and how to structure your applications, learning the other one is a matter of figuring out what functions/classes match up as well as the syntax of those functions/classes.

For me, DirectX was more of a struggle because I could wrap my head around certain aspects of it. But, it's gotten easier. Pick one, and roll with it. You can create amazing stuff with both of them, and they're both extremely powerful.

Share this post


Link to post
Share on other sites
Simian Man    1022
Quote:
Original post by Anonymous Poster
In another words, DirectX is as professional as you're going to get. In the business, I'd expect you to know both at the end, but the games on the market seems to suggest that DirectX is the better way to go for starters. Only those without a job right now would suggest otherwise.


What do the games on the market have to do with beginners?

I agree with Lazy Foo, OpenGL is definately easier.

Share this post


Link to post
Share on other sites
Promit    13246
Quote:
Original post by Dorvo
I'd have to agree with tha' Foo. I found OpenGL a lot easier to learn than DirectX.
This is a result of shitty literature on Direct3D rather than any inherent fault with D3D, but that doesn't really change the learning experience, I suppose. At least people who learn D3D first usually don't write code like this.

Share this post


Link to post
Share on other sites
Dorvo    272
Quote:
Original post by Promit
Quote:
Original post by Dorvo
I'd have to agree with tha' Foo. I found OpenGL a lot easier to learn than DirectX.
This is a result of shitty literature on Direct3D rather than any inherent fault with D3D, but that doesn't really change the learning experience, I suppose.


The official DirectX tutorials weren't too bad, but required a fair amount of playing around with. When I started out learning DirectX though, there were very few sites that had anything comprehensive. Nowadays, it's gotten better.

Quote:
At least people who learn D3D first usually don't write code like this.


Yeah, that's one thing I particularly like about DirectX; the buffers. I find that more structured and easier to maintain.
Edit: Err... I mean having been forced to use buffers. It forces you to think in an optimized manner, as opposed to brute force rendering.

Share this post


Link to post
Share on other sites
discman1028    212
DirectX/Direct3D (and Microsoft in general) really have their act together, in that MS Visual Studio, the DirectX SDK, Samples, FX, etc, are all coupled together very nicely.

That being said, OpenGL is much easier to use, as has been said. But, now learning Direct3D myself, I'm seeing how to make my applications much faster. (I didn't even know about vertex buffers before starting with Direct3D!)

So, I'd suggest (in chronological order):

1) Learn OpenGL fairly well, do some projects with it
2) Dive into Direct3D, try doing some comparable projects, or even porting the same ones to Direct3D to see the differences/analogous functions
3) Take a step back and compare yourself

Share this post


Link to post
Share on other sites
programwizard    100
Just to let you know, you don't have to learn OGL first; I jumped right into Direct3D with no prior experience on any other API, and I was able to pick it up fine. Just make sure you get a book on either API you want to learn, they're both too complex to be learned from an online tutorial (though I hear NeHe is pretty good for OpenGL).

Share this post


Link to post
Share on other sites
clouds    122
OpenGL all the ways!

OpenGL = you can use it with C or C++, cross platform, very good documented, lots of examples on net. Peoples say OpenGL have problems with extensions. This is not true. Is very easy to deal with them, and that makes it powerfull.

DirectX = another MS modification to real world. At every new version, something is added and something is removed!!! Good luck with COM interfaces and MS styles. You will fing the limitations later.

p.s. I was coding for D3D last 3 years, switched everything to OpenGL, and i got better results, overall, after i love OpenGL now. And i use it with C++ all the time.

Share this post


Link to post
Share on other sites
CTar    1134
The both have advantages and disadvantages. There is a lot of rumors about DirectX being harder than OpenGL, in my opinion that is not correct. If people themselves try it and conclude that OpenGL is the easiest I have no problem with it, but many just say OpenGL is easier because they heard someone more experienced say it (maybe many years ago). I found it much easier to understand DirectX because you needed to understand it. When I learned OpenGL I felt like I was just using other code. glIdentity is just something to put between drawings, glRotate[f/d] rotates the next object. But when suddenly the objects rotated around 0,0,0 instead of itself I had no idea what was wrong (I blamed my driver[grin]). Which is easier is pure personal opinion.

Quote:
From an article comparing D3D and OGL (2002)
Many OpenGL advocates point to something Carmack wrote several years ago, trashing Direct3D. Only, that was during the days Direct3D 5. In a much more recent post on www.slashdot.org, Carmack said that with the new advances in D3D, it could no longer be ignored. Direct3D has to be used by programmers along with OpenGL.


We have now used DirectX 9 for a long time and DirectX 10 will soon be out. Please if anyone says Carmack is smart and he doesn't like DirectX then ask them for a source, less than one year old (which is a lot in the graphics industry). Carmack actually said he liked the tools on the XBox360 (one of those "tools" is D3D, the DX version is called DirectX 9L if I remember correcly) better than the ones on the PlayStation 3 (here one of the tools is OpenGL, well a version of it). Please remember this doesn't mean that he favors DirectX either, it was the tools on XBox360 and PlayStation 3 he commented on not DirectX and OpenGL.

One thing which you want to take into consideration is that there could come some problems with OpenGL on Vista, noone can really answer how bad it will be, but more understanding is that OpenGL will be locked at some version and when using that version in windowed mode you will either have to switch to another skin or let the calls be translated to D3D calls. I haven't read a lot about this and some people here knows a lot more about the situation (but it appears that some people have signed a NDA). I wouldn't worry too much about this until Vista have been released. I think this is mentioned in the FAQ for the OpenGL forum.

I think it would help you the most to choose one, stick to it until you can create a very simple pixel/vertex shaded world (shaders will be very important in the near future, most games already use them). Then learn the other graphics API.

[Edited by - CTar on March 14, 2006 8:57:12 AM]

Share this post


Link to post
Share on other sites
CTar    1134
Quote:
Original post by clouds
OpenGL all the ways!

For an XBox or XBox360 game? Of course, we just have to ship some modified, most likely illegal, hardware with the game.

Quote:
Original post by clouds
OpenGL = you can use it with C or C++, cross platform

I believe you can also use DirectX with C and C++, and a lot of other languages. Cross platform, yes this is true, but if you plan to code for the XBoxes then you will still have to use DirectX.

Quote:
Original post by clouds
very good documented, lots of examples on net. Peoples say OpenGL have problems with extensions. This is not true. Is very easy to deal with them, and that makes it powerfull.

You say OpenGL is very good documented? It might be, but do you mean that DirectX is worse documented? From what I have seen the DirectX documentation seems MUCH better, but there is a little more books on OpenGL. I can't comment on the extension issue since I haven't used it, but I can imagine it is a hell to keep organized.

Quote:
Original post by clouds
DirectX = another MS modification to real world.

Ehh, I don't even think I have to comment on that. According to "who's online" then you are online... Using Windows XP, one of Microsoft's "modifications". Please don't turn this into a thread about how evil MS is.

Quote:
Original post by clouds
At every new version, something is added and something is removed!!! Good luck with COM interfaces and MS styles. You will fing the limitations later.

The graphic industry is evolving very quickly, graphic APIs need a way to support new features. OpenGL have chosen to add something called extensions which most people find ugly and a big problem in their applications. Microsoft have instead chosen to make, what they feel is, a cleaner interface, but let the developers need to update some of their code around once a year if they want to update to the next DirectX version. In OpenGL you'll have to add code to support new extensions. In both APIs you can ignore the changes (just don't update version in DirectX) or you can try to use the newest features. To use these new features you will have to do some updating of your code. Have you ever read the "What's new" list in DirectX? It is often short and in most changes it is some parameters changed or something added to the API.

Quote:
Original post by clouds
p.s. I was coding for D3D last 3 years, switched everything to OpenGL, and i got better results, overall, after i love OpenGL now. And i use it with C++ all the time.


You might be a better code with OpenGL, it might have something to do with using OpenGL on newer hardware (you used it after DirectX). In most professional applications I get better performance with Direct3D (newest GeForce driver, GeForce 6600GT), but that could be for a million of reasons, like a poor driver, better DirectX programmers, most focus on DirectX etc. But I can't give a reason since I don't know how these things works, just like in your code.

EDIT: In this post I defended DirectX (well actually Direct3D), but really I think they both have their place and on Linux, the play stations and the XBoxes there are no real choice you just have to learn what you can use on those platforms.

Share this post


Link to post
Share on other sites
Dorvo    272
Quote:
Original post by CTar
The both have advantages and disadvantages. There is a lot of rumors about DirectX being harder than OpenGL, in my opinion that is not correct. If people themselves try it and conclude that OpenGL I have no problem with it, but many just say OpenGL is easier because they heard someone more experienced say it (maybe many years ago).


For me, DirectX was more difficult to understand because I was struggling with Object-Oriented programming. Now that I've gotten loads better, picking up some docs on DirectX and going through them is very simple. Granted, DirectX does take a bit more code to set up than OpenGL; but, it does give you a better understanding, and (from my point of view) more control.

To Boder, all I can really say on choices, if you prefer doing things the OOP way, then take a gander at DirectX. If you're still struggling with OOP concepts, maybe you'll want to start with OpenGL. Nowadays, either one is sufficient as a starting point, and there's loads of information out on the net for both APIs.

Share this post


Link to post
Share on other sites
Rob Loach    1504
Quote:
Original post by Lazy Foo
Start out with OpenGL (it's easier to get off the ground), but you should eventually learn both.
Some would argue the other way around. DirectX is extremely object oriented (you're dealing with matrix objects) and object orientation is more natural to beginner programmers. OpenGL is extremely procedural (you're dealing with the matrix stack) which requires some background programming knowledge like the stack system, etc.

My advice would be to try both and see which one you like most and then focus on that. Once you get good with one, it's easy to go back and forth as the 3D concepts introduced in both APIs are generally the same [wink].

Share this post


Link to post
Share on other sites
Promit    13246
Quote:
Original post by CTar
One thing which you want to take into consideration is that there could come some problems with OpenGL on Vista, noone can really answer how bad it will be, but more understanding is that OpenGL will be locked at some version and when using that version in windowed mode you will either have to switch to another skin or let the calls be translated to D3D calls.
Actually we can say how bad it will be, because the rumors were debunked a while ago. There will be no problems with OpenGL on Vista.
Quote:
OpenGL all the ways!

OpenGL = you can use it with C or C++, cross platform, very good documented, lots of examples on net. Peoples say OpenGL have problems with extensions. This is not true. Is very easy to deal with them, and that makes it powerfull.

DirectX = another MS modification to real world. At every new version, something is added and something is removed!!! Good luck with COM interfaces and MS styles. You will fing the limitations later.

p.s. I was coding for D3D last 3 years, switched everything to OpenGL, and i got better results, overall, after i love OpenGL now. And i use it with C++ all the time.
I suppose it's quite unfortunate, then, that the vast majority of the game industry does not agree with you. Except for games based on id tech, and games running on other OSes, very few use OpenGL. In fact, I can't think of any non-D3 based games that are using OpenGL. Even Unreal, Warcraft 3, and the handful of other portable titles will use Direct3D on Windows.

My final word on the matter is this. Load a textured mesh in OpenGL. Load a textured mesh in Direct3D. QED. (For you clever ones who are familiar with the 3rd party OpenGL libraries, now fix bowties and other inconsistencies in your mesh, optimize it for optimal vertex cache usage, and compute normals and tangents. We're up to maybe 10 lines of D3DX code here.)

Share this post


Link to post
Share on other sites
CTar    1134
Quote:
Original post by Promit
Quote:
Original post by CTar
One thing which you want to take into consideration is that there could come some problems with OpenGL on Vista, noone can really answer how bad it will be, but more understanding is that OpenGL will be locked at some version and when using that version in windowed mode you will either have to switch to another skin or let the calls be translated to D3D calls.
Actually we can say how bad it will be, because the rumors were debunked a while ago. There will be no problems with OpenGL on Vista.


Wow, that's very nice. All those rumors were making me really scared.

Share this post


Link to post
Share on other sites
superjaws    115
thank you all for your replies
sorry it has taken my so long to check back
Quote:
Original post by jollyjeffers
What sort of projects do you want to work on? Purely games, (scientific) visualisation, general graphics?

Is it for your own personal amusement, or do you want to (eventually) sell any games you make?

Which of MS Windows, Linux or MacOS your "home" Operating System?



Ok jeffers here's the answers to your questions:
I want to make games
I hope to some day make an online game with a business model simialar to MapleStory and GunBound (free to download and play and players can pay me real money for ingame money)
And my home system is Windows

Share this post


Link to post
Share on other sites
Lazy Foo    1113
Quote:
Original post by Promit
I suppose it's quite unfortunate, then, that the vast majority of the game industry does not agree with you.


As if the Windows PC + Xbox are the only (or even the largest combined) platforms to make games on.

Share this post


Link to post
Share on other sites
Promit    13246
Quote:
Original post by Lazy Foo
Quote:
Original post by Promit
I suppose it's quite unfortunate, then, that the vast majority of the game industry does not agree with you.


As if the Windows PC + Xbox are the only (or even the largest combined) platforms to make games on.

Neither PS2 nor Gamecube (the other two significant platforms) use either OpenGL or Direct3D; as a consequence they are utterly irrelevant to this discussion. There's something to be said for OpenGL|ES if you're in that arena, but again your choice is generally dictated by the device. So, as far as this discussion is concerned, PC is the only platform to make games on.

Share this post


Link to post
Share on other sites
jyk    2094
Quote:
Original post by Promit
So, as far as this discussion is concerned, PC is the only platform to make games on.
Maybe I'm missing the context, but are you saying it's not worth developing games for any other (non-console) platform other than the Windows PC?

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