Sign in to follow this  

dif between openGL and DX9 ?

This topic is 4751 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

What is the difference between these API's? What ae the factors that make one choose ove the other? 2 Question: i have read and learned about the structure of a game loop (with interpolation, game ticks, ...) and am wonering when do you actually use such a loop? Both api's seem to have abstracted the game loop (DX with it's event loop, openGL with ? ) ?

Share this post


Link to post
Share on other sites
DirectX uses classes. OpenGL uses functions :P.

Some people learn them both. OpenGL was easier to learn to me. Direct3D tended to be a bit harder to learn.

So far as i know. Game loop is up to the programmer, not the api.

A primitive game loop would be like
done = false;
while(!done)
{
render(); // would do all the rendering stuff in DirectX or OpenGL.
soundstuff();
input();
if(userquits)
done = true;
}

Share this post


Link to post
Share on other sites
I learned OpenGL and the .Net version of DirectX, and I still thought that OpenGL was easier to learn.

DirectX provides a lot more functions though than OpenGL, since OpenGL only does graphics (DX has sound, input, network stuff, ...). The .Net Version of DX does provide a game loop (if you want it, they don't force it on you), and the game loop isn't that hard to work with; it will automatically do simple things like find frames per second, update simple gui's, and the like; and call the functions or classes you want called during the program's update.

DirectX though is not an open standard. OpenGL is, and will work on many different platforms (DX is designed only for Windows). Some parts of DX have also semi-recently become depreciated by Microsoft and they plan to replace it with something called XNA (looks neat, but have to wait and see).

I'd choose what ever is the most appropriate for your objective (both have their strengths), I'd recommend though writing your program so that all of the DX or OpenGL specific code is in appropriate classes so that they could be swapped for other methods in the future with out a major reinvestment of time.

Share this post


Link to post
Share on other sites
If your interested in cross-platform development then I'd go with OpenGL. I would even use something like SDL with OpenGL so you wouldn't need to worry about Window Initization.

If you want to use one API that will take care of input, graphics, sound, networking, and some other minor things, then DX9 is the API you want to learn.

I would recommend looking at both, and seeing which one you're more comfortable with. I happened to like OpenGL better, so I'm sticking with that one.
However, there are other libraries that can do input, sound, and networking and are cross-platform, so if you're willing to learn a few different APIs then you could still use OpenGL and other libraries to get most of the features that DX9 provides.

In terms of graphics quality and speed, if you use the right functions in both APIs, then they will both be close in speed. Near Equal graphics quality can be achieved in both as well, just look at Doom3 (OpenGL) and HL2 (DX9).

Share this post


Link to post
Share on other sites
I plan to teach myself C++ game programming. I have been programming games in Java for 2 years, bu not using any api's. SO I understan the basic echniques of game programming, and am now trying to pick the right api to work with. I will be going develop for Windows. All in all, I would much perfer using functions over classes, so I am guessing I will start with openGL, unless there is something else I need to know/ be advised upon.

Also, I am not aiming at high end 3d graphics. My game will be a C++ version of a 2d FF6 style isometric rpg that I had developed in Java. Please kep this in mind if offering any more advice. Thanks, you guys are the best :)

Share this post


Link to post
Share on other sites
DirectX is closed-source, proprietary, non-portable and cannot have card-specific optimizations done for it a la 3DFX MiniGL without MSFT approval.

If you want to even consider targeting Linux or OS X (and I recommend you do! We have money and are starving for games), it will take a long time to convert a DX game.

Share this post


Link to post
Share on other sites

This topic is 4751 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