What is the difference and advantages of Opengl and Directx and when to use?

Asked

Viewed 55,032 times

4

I have entered some sites and some speak well of Opengl for being cross-platform, others advocating the use of directx due to being microsoft and say it is easier to use, others talk to instead of directly using Opengl use SDL. I’m starting to see now this part of programming using graphic libraries, I wanted to know what the main difference between one and the other in terms of performance and ease of use and when it is more appropriate to use each one.

  • 3

    Take a look at this Wiki article: http://en.wikipedia.org/wiki/Comparison_of_OpenGL_and_Direct3D And then this one about Alve: http://www.extremetech.com/gaming/133824-valve-opengl-is-faster-than-directx-even-on-windows I think it might help you a little bit, this subject is a little complex to answer in such a general way.

  • @Zanoldor li, they’re really good! Opengl 4 beat Directx was something I can’t imagine.

  • 1

    Hello. I agree with @Zanoldor. I also think your question is a bit comprehensive. I understand that comparing Opengl and Directx makes sense because both are similar API’s for 2D or 3D graphics rendering. But I don’t know if SDL and mainly Unity3d should be included in the same "cake" because they do much more than that (and actually reuse the previous two).

  • @Luizvieira Opengl and Directx I until I had a little bit of notion the others I know almost nothing even. Maybe I got really extensive.

  • Both SDL and Unity3d are for the same purpose, just as Opengl is for Directx? That if so I dismember in a new question.

  • @Luizvieira you are right, after I researched a little I saw that it would be really extensive a good explanation and that would be to mix a lot of things. I broke into two questions.

  • So, "be for the same purpose" they can all be (or not). There are Brazilian agencies developing websites in Unity3d, and it was initially created for games. The issue is that Opengl and Directx are libraries for graphical rendering, SDL is an audio access library, data entry and rendering, and Unity3d is a complete game engine (with physics emulation, animations, integrated visual editor, etc, etc, etc., etc).

  • Type this Unity3d is more like a similar Unreal engine.

  • 1

    Yes, indeed it is a competitor of Unreal. It has numerous other options (some freeware): http://en.wikipedia.org/wiki/List_of_game_engines

  • @Luizvieira very cool, I did not study this engine part, but I really liked this link.

Show 5 more comments

1 answer

8


The big difference is 2D vs. 3D!

The graphical part of the SDL gives an API to make 2D graphics, while Opengl provides you both 2D and 3D.

Importantly, the SDL also provides several Apis in addition to graphics: audio, mouse, keyboard, joystick, etc. I can’t say the same for Opengl (because I never used it), but it is very common to see it being used with other frameworks for the things which are not just graphics (very common use Openal for audio for example).

Another thing, while the SDL API does not give you functions to render 3D graphics, it is possible to use Opengl for this part along with the SDL.

But which way to go?

SDL

If you are just starting to develop games (is it for games?) and (yet) do not have in mind to pursue a career in this area or already use a famous engine the best is SDL.

SDL is an excellent choice to go understand essential concepts of game development. The API is very simple to understand and very "raw", IE, most of the logic will be on your own and hence come a great learning (as control of frame rate, for example).

Another positive point of the SDL is that it also supports Opengl; that is, when you are ready to go to 3D, you will be focused exactly on this (since the rest you have learned from SDL).

Bonus: SDL 2 supports android!

Opengl (and Directx)

Already Opengl is much more dense that SDL, are many concepts and is a little more complicated to arrive at a result working. The great advantage is that it will give you the opportunity to work with the most famous Engines.

But I warn you, if it’s just a hobby, it can be a little disheartening to start with something this big.

Opengl is portable to Windows, Linux, Mac OS, and the Playstation platform.

Directx, being from Microsoft is specifically aimed at Windows and parallel systems like Windows Phone or Xbox.

Follow this trail if you want to make games that require high performance (mainly 3D). Both Apis offer a hardware access layer and make it possible to program specifically for a video card (in the case of HLSL and GLSL Shaders).


Unity

Also add to your list Unity!

I know little (nothing incidentally) about Unity, but it is remarkable how he seeing growing lately.

Recent examples are Blizzard’s latest game, Hearthstone, that uses Unity and also the purchase by Microsoft of Unityvs, that integrates Unity to Visual Studio (before this plugin was paid but now it will be for free!).

  • It includes Unity, that I had not even heard of. It is for game yes, but at the level of hobby same.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.