Sign in to follow this  
Phillipe

OpenGL DirectX versus OpenGL - A very newbie question...

Recommended Posts

Hello there. I was wondering, is the only difference between the DirectX API and the OpenGL API is that the OpenGL API is being supported by more OSs and game stations than the DirectX API does (while DirectX runs only under the Windows OS and maybe on some game stations, I'm not totally sure - OpenGL runs under the Linux, Mac OS X and Windows OSs AND under the Game-cube, X-box and Playstation game stations)? As far as my understanding goes, they both capable of the same abilities (that is, performance wise and functionality wise). So, is the aforementioned correct? The only difference between the two APIs is that the OpenGL API is being supported by more OSs and game stations than the DirectX API does? IMO there must be another difference, because an API that is being supported by more OSs and game stations than another API AND that has the same abilities as the other API would have been used by every programmer (more OSs and game stations that support the API you are using = more copies of your software being sold). Am I correct? I'm asking this because I've just finished my C++ course and I'm ready to start and learn some API, I just don't know which one to choose (well, it must be one of the two mentioned above - DirectX\OpenGL. SDL and such are not "sophisticated" enough for a decent programmer such as I [wink]). I got all the foundations needed (that is, math, physics, high-level programming language, etcetera...), all I need to know is the differences between the two (advantages\disadvantages). Thanks a lot in advance, Arie. P.S. - I'm sorry if this question has been asked before (and I'm sure it has [rolleyes]), I just couldn't seem to find the answers I'm looking for anywhere. Thanks a lot again. [smile]

Share this post


Link to post
Share on other sites
While OpenGL is an API for rendering graphics, DirectX is an API for graphics, sound, video, input and networking. There are still other APIs like OpenAL.

Anyways, if you create a game engine, provide enough abstraction to let the user select between OpenGL and DirectX. Sometimes the graphics drivers for one of them are better than for the other. I think it will also lead to a better design of your engine.

Share this post


Link to post
Share on other sites
AP: I know they are, as you said, "almost the same". My question is how they differ from one another? does one give you more control? more efficiency? what ARE the differences between them?
Thanks a lot [smile].

Share this post


Link to post
Share on other sites
I believe we have a fairly fresh topic about this, here. Perhaps you can find some information there. Actually, there is an article about it, too, right here.

To answer your question specifically, yes, OpenGL supports multiple platforms. However, in my experience, I've found that not many gamers play on those other platforms, anyways. Most stay with Windows.

However, the exception to this is with the Sony line on consoles. The PS2 uses OpenGL for rendering (IIRC), and with the advent of OpenGL-ES, only more are going to use it. On the other hand, Direct3D is also used on both the XBOX and the XBOX2 (aka Xenon).

If you spend the time to learn the fundamentals of graphics programming, then learning both really isn't that hard at all. However, it's important that you understand the concepts behind them, first.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Phillipe
My question is how they differ from one another? does one give you more control?

No/

Quote:
Original post by Phillipe
more efficiency?

No.

Quote:
Original post by Phillipe
what ARE the differences between them?


Besides that DX provides input, sound, network and only runs on Windows and XBox, both are the same. That includes control and efficiency.

It is good to know both.

Share this post


Link to post
Share on other sites
So I see... Well - learning both and letting the user choose which API would he like to run the software under seems like the ultimate answer for all my questions.
But yet, as said above (or somewhere else I jsut can't seem to recall where), OpenGL is a Graphic API (that is, it is only taking care of the aspect of displaying objects on the screen) while DirectX is a Multimedia API (that is, it is taking care of the same thing that the OpenGL API does plus it is talking care of the networking, sound, etcetera...).
So, assuming I only know OpenGL, how am I supposed to control the sound and networking, for example?
Thanks a lot in advance [smile].

Share this post


Link to post
Share on other sites
Direct3D is more frequently and, IMO, coherently updated, but new functionality provided by certain hardware can not be used until officially "rolled in." OpenGL API updates are less frequent, but new functionality can be accessed through vendor extensions, which eventually migrate into ARB extensions.

Quote:
Original post by Phillipe
So, assuming I only know OpenGL, how am I supposed to control the sound and networking, for example?
There are multiplatform abstraction libraries for many of these aspects, such as OpenAL or FMOD for sound and HawkNL for networking. We have an Alternative Game Libraries forum dedicated to these various libraries, for instance.

Share this post


Link to post
Share on other sites
It's important to understand that you CAN use the individual components of DirectX separately. For instance you CAN use DirectSound with OpenGL. Or Direct3D with some other networking library, etc... So for Microsoft-based platforms, you might as well just use DirectX for the non-graphics components until something better pops up. If you design your software carefully, it should, theoretically, be very easy to replace any platform specific APIs.

For other platforms, I really can't say since I don't have experience with any. I'm sure their are several, free, libraries out their. FMOD for sound has come up plenty of times. It's supposed to be platform independent and free.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Oluseyi
Direct3D is more frequently and, IMO, coherently updated, but new functionality provided by certain hardware can not be used until officially "rolled in." OpenGL API updates are less frequent, but new functionality can be accessed through vendor extensions, which eventually migrate into ARB extensions.


Oluseyi, sorry for this stupid question, but how exactly does OpenGL get updated? DirectX has the dowloadable SDK from Microsoft but for the life of me I cannot find downloadable OpenGL libs. I know that there are OpenGL libs implemented by Microsoft and packaged in VC++ but how do you get to update that?

Thanks.

Share this post


Link to post
Share on other sites
Quote:
Original post by circlesoft
The PS2 uses OpenGL for rendering (IIRC)


Not natively, you need to do something special to get it to work (maybe as drastic as installing linux).

Share this post


Link to post
Share on other sites
Assuming you mean Direct3D (since as mentioned by others, DirectX is a collection of APIs), there really isn't much difference. Both APIs abstract the same hardware functionality, mostly differing due to the philosophy of the API (OpenGL being C and extension-based, while D3D uses COM/OO and periodic updates).

Use either based on your goals (ie. cross-platform you'll pick OpenGL) and preferences (like OO and don't need cross-platform, use D3D).

If you understand the functionality offered and how it works, you'll have no problem switching at a later point. I hadn't used OpenGL in years, but when I decided to go cross-platform, switching was a snap. Toss in a extension handling lib like GLEW, browse the docs, and you're set.

Share this post


Link to post
Share on other sites
Quote:
Original post by Promit
Quote:
Original post by circlesoft
The PS2 uses OpenGL for rendering (IIRC)

Not natively, you need to do something special to get it to work (maybe as drastic as installing linux).


Aye, okay. I am assuming it just uses an API designed by Sony, then. I heard rumors that the PS3 was supporting OpenGL or something - do you know anything about that?

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Oluseyi, sorry for this stupid question, but how exactly does OpenGL get updated? DirectX has the dowloadable SDK from Microsoft but for the life of me I cannot find downloadable OpenGL libs. I know that there are OpenGL libs implemented by Microsoft and packaged in VC++ but how do you get to update that?

Thanks.
Microsoft has not updated the OpenGL libs for Windows in a long time, but they promise that Longhorn will have up-to-date Windows libs (OpenGL 2.0, for now). To access functionality beyond the 1.1 version provided for Windows by Microsoft, Dave Astle (yes, our very own Myopic Rhino) wrote Moving Beyond OpenGL 1.1 for Windows. It only applies to 1.2 and 1.3, but I believe it should be intuitable to 1.4.

Share this post


Link to post
Share on other sites
Quote:
Original post by circlesoft
I am assuming [the PS2] just uses an API designed by Sony, then.
From what I hear, while there is an available API from Sony, it's hardly performant. Most developers end up writing their own pedal-to-the-metal libraries for the PS2, which is why it took a while for the full graphical potential of the system to be tapped. That the hardware architecture was ... "challenging" ... didn't make anyone's life easoer [smile].

Quote:
I heard rumors that the PS3 was supporting OpenGL or something - do you know anything about that?
I have no information, but it'd be a good thing. Now if only Microsoft could find a way to interface OpenGL with its proposed XNA, demonstrating that it truly isn't about establishing D3D as the only viable option...

*sigh*

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Oluseyi, sorry for this stupid question, but how exactly does OpenGL get updated? DirectX has the dowloadable SDK from Microsoft but for the life of me I cannot find downloadable OpenGL libs. I know that there are OpenGL libs implemented by Microsoft and packaged in VC++ but how do you get to update that?


The answer to this question is why we love MS so much. You can't! Because Microsoft has DX it refuses to update the OpenGL libs on windows from the 1.1 versions you get standard (pretty sure its 1.1, but its quite an old version anyway). The drivers to your graphics card will give you access to all the avaliable OpenGL functions and extensions supported but as there is no Windows lib or .h files so you can't compile them into your app directly. The work around to this is to use function pointers. Basically you request a pointer to the extension you want and then your graphics driver gives it to you if supported. Its a bit annoying at first but once you get your head around it, its not a big deal. Still its very much a hack, and its a pitty there is no better way round it but not much you can do about it. MS has no reason to support/help out an API thats in competition with them so they've made it as hard as possible to use any new features.

Or at least thats how I understand it :P

Share this post


Link to post
Share on other sites
A point worth noting is that the PC (windows) is home based and therefore
has games being played on it. Many of the other platforms are for buisness
and they kind of frown on game playing. So I am beginning to see
the cross platform of OPENGl is not that big a deal for games.
I could be wrong but that is my opinion.

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