Sign in to follow this  

API's

This topic is 4833 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm sorta new to the concept of API's. I know about DirectX and OpenGL and they allow you to control things like graphics and sound, but which do I use? I was looking at several of my games and it seems that graphics are controlled by OpenGL but sound is controlled by DirectX. Is this a good idea? What is the difference between OpenGL and OpenML. Also, what elements do API's control and which API should I use. Are they just: Graphics(OGL or DX) Sound(OGL or DX) & Input(OGL or DX) or is there more. And what books and SDK's should I get or where should I learn?

Share this post


Link to post
Share on other sites
OpenGL is just graphics, that's why you see people using directX for sound and input.

SDL will also do sound and input. it might be worth looking at that.

I suggest starting out with learning SDL, then moving to OpenGL (for the graphics part, of course)

Share this post


Link to post
Share on other sites
Highly suggest SDL (click) for beginners. All you really have to focus on with SDL is the game -- there is no complex setup as there is with Windows programming, which you'll need to somewhat learn if you want to use DirectX.

However, if you want to learn windows programming, you can use DirectX, but it is somewhat complicated depennding on your level of experience.

Share this post


Link to post
Share on other sites
To start, there's quite a bit of information on individual API's and API subsystems here. More than I can tell you in one post.

Also, no matter how hard you try, nobody can tell you which one is better, or which one you should use. If you be specific with questions and do some of your own research, you can get more information than you ever wanted, but you'll ultimately have to decide which API to learn in the end.

OpenGL (Open Graphics Library) is a cross platform Graphics API. It does not handle input, sound, or any of the other functions that DirectX can handle.

OpenAL (Open Audio Library) is the OpenGL of audio. It is also cross platform.

DirectX is not one API, but a collection of several API's.
All of the DirectX API's work similarly, but can only be used on Windows.
Direct3D handles graphics.
DirectInput handles input.
There are also more API's for sound/multimedia and networking.

Because DirectX is not an all-or-nothing API, you can easily mix OpenGL with DirectInput, or sound, or networking, or any other compenents. You just won't be able to use two different graphics API's at once. However, you must keep in mind that if you mix OpenGL with DirectX, you lose cross platform portability. This may or may not matter to you.

SDL is a great library to use to begin using OpenGL. It allows for simple window creation, avoiding Win32, and it takes care of sound and input.

For some great OpenGL tutorials, check out NeHe.
There are plenty of DirectX tutorals out there, but having started with OpenGL, I don't know as well as others where to start.

Anyway, my advice is, pick one and learn some of it. If you don't like it, or if you feel curious, try another option. None of what you learn will ever go to waste, so there is no wrong choice.

Good luck.

Share this post


Link to post
Share on other sites
Quote:
Original post by Yamian
So I can learn SDL then OpenGL and completely forget DirectX? Well where should I learn SDL? And where shoudl i download the liabraries for SDL and OpenGL? Any SDL books?

SDL Tutorials
OpenGL Tutorials
SDL Page
OpenGL Page

Edit: I also suggest that you don't completely ignore DirectX. Even if you glance over some samples and decide to ignore it for a while, you'll be more likely to make a better choice.

Share this post


Link to post
Share on other sites
Quote:
Original post by Yamian
If I used just SDL and OpenGL, would the programs work with Macs or Linux?

Using SDL and OpenGL, your programs could work on Macs and Linux. You still have to be careful about general C/C++ code that can only run on Windows (such as Win32), but if you ever decided to port one of your programs to Linux from Windows, it would be infinitely easier with an API that works on the other platforms.

Share this post


Link to post
Share on other sites

This topic is 4833 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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