What is the difference and advantages of OpenGL, and DirectX over each other and when to use?

I have entered some sites and some speak well of OpenGL for being cross-platform, others defending the use of directx due to being microsoft and say it is easier to use, others speak 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 differences between one and the other in terms of performance and ease of Use and when it is most indicated the use of each a.

Author: Sileno Brito, 2014-07-03

1 answers

The big difference is 2D vs. 3D!

The graphics part of SDL de gives you an API for making 2D graphics, while OpenGL provides you with both 2D and 3D.

Importantly SDL also provides several APIs in addition to graphics: audio, mouse, keyboard, joystick, etc. I can't say the same for OpenGL (since I've never used it), but it's very common to see it being used with other frameworks for the things that are not just graphics (very common to use OpenAL for audio for example).

Another thing, while the SDL API doesn't give you functions to render 3D graphics, you can use OpenGL for that part along with SDL.

But which way to go?

SDL

If you are just starting to develop games (is it for games?) and (still) 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", that is, most of the logic will be on its own and from there come a great learning (such as control of frame rate, for example).

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

Bonus: SDL 2 supports android!

OpenGL (e DirectX)

Already OpenGL is much more dense than SDL, are many concepts and is a bit more complicated to get a working result. The great advantage is that it will give you the opportunity to work with the most famous engines.

But the caveat remains: if it's just a hobby, it can be a little disheartening to start with something that big.

OpenGL is portable for Windows operating systems, Linux, Mac OS and the PlayStation platform.

DirectX, being Microsoft is specifically aimed at Windows and parallel systems such as Windows Phone or Xbox.

Follow this trail if you want to make games that require high performance (3D mostly). 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 put in your list Unity!

I know little (nothing incidentally) about Unity, but it's remarkable how it's seen growing lately.

Recent examples are Blizzard's latest Game, Hearthstone , which uses Unity and also purchased by Microsoft from UnityVS , which integrates Unity with Visual Studio (previously this plugin was paid but now it will be free!).

 6
Author: talles, 2014-07-03 17:41:35