Public Group

# Choosing an API

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

## Recommended Posts

Hello, I'm new here but have been interested in developing games a long time ago. These holidays I've decided to stop being a player and start developing. I'm good at general programming, still need to learn C++ more in depth in order to properly game code. Apart from that, the problem is a decision which I can't make: What API should I choose after learning the basics and start mastering one? This an important decision which I'd like to be fully aware of, I know the game industry mainly develops in DirectX and engines based on it, thus Windows platform, however I'd like to know the pros and cons of DirectX, OpenGL or some other game engine despite this fact, since for a start I'm going to game code for learning purposes only.

##### Share on other sites
If you're new to game programming and want to use C++, I'd suggest checking out Ogre. It's and easy way to start learning some of the more general game programming methods without worrying too much about the graphics. Under the hood (and Ogre is open source so you can check it out) Ogre is capable of both DirectX 9 and OpenGL under Windows and is also available with OpenGL for OS X and Linux. Ogre allows for a lot of results from minimal code (in terms of graphics) and also has a few plugins for physics and other things (such as OgreNewt).

If you are wanting to take the head first plunge into directly using the APIs, I'd suggest OpenGL first. That was the path I took and I think it helped. DirectX uses a very OO structure for everything whereas OpenGL is very much procedural. I believe that OpenGL helps with learning graphics programming by exposing an immediate mode of drawing whereas DirectX really only works using VertexBuffers and the like. While you would always want to use VertexBuffers and such in games for performance increase, as a beginner they sometimes hinder the learning process. That's one plus for OpenGL. You can easily program in shapes like this:

glBegin(GL_QUADS);glVertex2f(-1, -1);glVertex2f(-1, 1);glVertex2f(1, 1);glVertex2f(1, -1);glEnd();

So it really makes things easier. From immediate mode you can step up to display lists and then into vertex buffers. OpenGL does have the GLSL shading language available for more advanced graphics. For sure I know that Blizzard uses OpenGL for it's games (hence World of Warcraft being cross platform in a single package) and it seem that id has begun (or always has) used OpenGL for it's engines. I'm sure others do, but those are the two big ones.

##### Share on other sites
As for Direct3D compared to OpenGL, they both have in all but the most extreme cases exactly the same capabilites. But the most obvoius difference, from a programmers point of view anyway, is that D3D follows an OO paradigm while OpenGL is exposed as a procedural library. In that aspect, it just comes down to a matter of taste of the programmer(s). The other major argument is that D3D is for Windows and XBox only, while OpenGL can in addition to Windows run on the various UNIX flavours, including OS X and Linux, and also in some meaning (read: OpenGL|ES) on the Playstation 3.

There are of course many more minor differances, but I can almost guarantee that once you have a reason to care about those, you'll have the experience to know for yourself what to do.

As for which API, you should choose now...I'm afraid I cannot give any concrete advice other than in addition to D3D and OGL check out other api's like XNA, SDL, Torque and such and then decide for yourself which one you like best. I would actually argue that it wouldn't matter all that much which one you'll choose, as you'll be able to make a game in any of them with a certain amount of dedication.

The general rule of thumb though is: High-Level API's => Rapid development but poorer control of details, and the reverse: Low-Level API's => Lower productivity but greater control.

If you never made any game at all before though, you probably would want to look towards the slightly higher-level api's...

And as a footnote, you might want to keep an eye on this thread as it covers a bit of the same subject.

##### Share on other sites
Work with both of them, and with some other frameworks and engines as well. What happens when you're only familiar with one API? When a new thing gets introduced, you'll then have a hard time adapting to it. If you're already familiar with multiple API's and frameworks, you'll be able to see more similarities and differences, and adapting will be easier.

I worked with OpenGL a bit some years ago. During my internship at a local game company however, I had to work with Java (mobile games) and C (Nintendo DS). In both cases, the libraries I got to work with were fairly new to me. So, no sign of OpenGL or DirectX there, but since I had worked with DirectDraw a bit I was familiar with how 2D graphics are handled - not a comlex thing, granted, but every bit helps. Besides, for the bigger games, you'll probably be working with an existing engine anyway, so don't limit yourself to low-level API's only.

So, it depends a lot on the situation, but generally, it's good to have a solid and broad experience, so you're able to work with new things faster. It's a dynamic world we're living in after all. :)

##### Share on other sites
Thanks for the feedback, that cleared some of my doubts.
I think I'll start with OpenGL since it seems to help the learning process and try DirectX later on to try and adapt to a new API.
Also Captain P, as I said it's only for learning purposes and therefore I don't think I'll be forced to use specific tools later on. However I'll take that in count since I'm going to university (not a gaming course) next year and I think they start off with Java.

##### Share on other sites
Another question which I just had is, since I'm going to use OpenGL and don't need to stay on Windows, which IDE should I use, should I stick with VS 2005 or is there another tool which is "popular" among game coders (such as DevC++) ?

Sorry if I'm giving the tools that I want to develop with a lot of importance, but I really like to choose those with the highest criteria.

##### Share on other sites
Stick with Visual Studio; it's an excellent IDE.

##### Share on other sites
Personally, I like DevC++, but if you like VS then stick with it.

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 10
• 9
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
633685
• Total Posts
3013323
×