OpenGL vs. DirectX

Started by
8 comments, last by Kylotan 17 years, 1 month ago
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
Advertisement
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.
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
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.
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.
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.
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.
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.
I personally am a fan of OPGL. Available for any platform (or as many as i'm aware of)
Indy to Pro: Journeyhttp://phiendstudios.blogspot.com
There are many previous threads on this, and we actively discourage the creation of new ones.

This topic is closed to new replies.

Advertisement