Sign in to follow this  
ChandlerT

OpenGL vs. DirectX

Recommended Posts

ChandlerT    110
I've seen a bunch of different posts about programming engines or types of engines and the most common I've seen are OpenGL and DirectX. I was curious, what are the core differences between the two? Which are better to use if you were to build your own engine? Sorry if this is wrong forum. Appreciate any help. Thanks

Share this post


Link to post
Share on other sites
CrimsonSun    336
The differences are essentially syntax and support. DirectX runs natively solely on windows. OpenGL can run on other platforms natively such as linux and MacOS.

Platform support aside, for all intents are purposes the two are essentially the same.

Share this post


Link to post
Share on other sites
ChandlerT    110
So OpenGL is more multi-purpose operating system wise? So wouldn't OpenGL be better for all purposes, or since DirectX is only on Windows is it easier/better to use?

Thanks

Share this post


Link to post
Share on other sites
Simian Man    1022
Well, if you only care about Windows, DirectX probably has better support, but I'm of the persuasion that you should support as many platforms as possible.

Either way, writing rendering code with these APIs is a relatively small part of making a game engine. Good engines don't rely on the API at all, allowing you to use either from the same engine interface.

Just pick one and start learning it. They're very similar.

Share this post


Link to post
Share on other sites
CrimsonSun    336
I forgot to clarify something earlier. DirectX contains a large amount of different libraries that handle input, sound, rendering, etc. OpenGL only provides for rendering, so you'll have to find other libraries to handle input and sound or write them yourself. Usually when you see discussions about OpenGL vs. DirectX, they're mislabeled and really are about OpenGL vs. D3D (which is the rendering portion of DirectX).

As for which one is better, that depends, and every single person is going to give you a different answer. However, if you want to port your applications to other platforms then you don't have much of a choice between the two. If you learn one then it will be relatively easy to learn the other later on.

Share this post


Link to post
Share on other sites
Xai    1848
As mentioned earlier, in real games OpenGL vs. Direct3D is a non-issue because you have an "engine" that has that code in it, and the "game" sits on top of the engine and doesn't even know or care which is being used (some game engines support just 1, some support both).

For 3D graphics you use either OpenGL or Direct3D

For Sound you use either DirectSound, OpenAL, or other libraries. Also there are
additional libraries like DirectMusic and DirectPlay (and others if you aren't using DirectX) that add helpful features.

For Input (joysticks, etc) you use either DirectInput, XNA, or other code (strait Win32, libraries I don't know).

For Networking you use either WinSock or other libraries (DirectPlay is no longer used).

Personally I have used DirectDraw (2D previous version), OpenGl (2D and 3D), DirectSound, DirectMusic, and OpenAL and can say they are all pretty easy to use and have decent features. Haven't used WinSock (friend does that), haven't used DirectInput. Rewrote some bad code that used DirectShow to use DirectSound instead to remove bad performance and behavior, but DirectShow does offer features not in other libraries, I just don't like it.

Share this post


Link to post
Share on other sites
Simian Man    1022
I would just like to add that SDL provides cross-platform support for sound, input, networking, etc. It is a great addition to OpenGL if you're aiming at cross-platform development.

Share this post


Link to post
Share on other sites
Ravuya    135
Quote:
Original post by Simian Man
I would just like to add that SDL provides cross-platform support for sound, input, networking, etc. It is a great addition to OpenGL if you're aiming at cross-platform development.
I agree. SDL was intended to replace the non-Direct3D components of DirectX-based games when porting to Linux; it's very powerful on both Windows and other operating systems.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this