Jump to content
  • Advertisement
Sign in to follow this  
darekg11

OpenGL DirectX 9.0 vs OpenGl 2.1

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

Hi, I have GeForce 7600GS 265MB DDR2 and it handles DirectX 9.0 and Open GL 2.1. I really do not like c++, I don't know I just hate classes. And as far as I know DirectX API is C++ API. For me it seems that there is BIG difference between abilities of DirectX 9.0 and Open GL 2.1. So my question is am I right?

Share this post


Link to post
Share on other sites
Advertisement
You can call DirectX methods directly from C, though it's slightly annoying to do so.

You could compile your application as C++ but write the code like C, as C++ is a superset of C (for the most part). That would let you retain your non-OO style while using DirectX's C++ API more cleanly.

Share this post


Link to post
Share on other sites
Someone more familiar with OpenGL versions will have to answer that for sure, though Wikipedia's entry on OpenGL describes the changes between versions. OpenGL 2.1's core might lag behind D3D 9 a bit but extensions (both ARB and Nvidia) should let you achieve similar functionality. Ultimately it depends what you're trying to achieve.

Share this post


Link to post
Share on other sites
There's not much difference between the capabilities of both APIs; D3D9 includes some features (like hardware geometry instancing) that aren't in core GL 2.1, OpenGL is a little easier in that it lets you mix and match old-style (immediate mode/fixed pipeline) code with newer-style (VBOs/shaders) code more naturally, but overall they're mostly the same and - especially if you're using VBOs and shaders - the learning curve is more or less identical. Driver support for D3D tends to be more robust, but that's irrelevant for you since you're on NVIDIA (which has a very good OpenGL driver). OpenGL has a lot of really old and/or esoteric capabilities that are either poorly supported or not supported at all in hardware. D3D tends to expose more of the ugliness of dealing directly with hardware, OpenGL shields you from it a little better, but the tradeoff is that D3D gives you slightly better hands-on control of some things.

But on balance you can treat them as being identical capabilities-wise; there really is very little difference.

The general recommendation that you'll get is that longer-term you should learn both, so the only real question is: which do you learn first? That's down to your own personal preference really, so why not try a basic "first triangle" program in both and see how you get on, then make a decision?

Share this post


Link to post
Share on other sites
Thank You very much, I was waiting for this kind of anwser. I will render triangle in both and i will see what I like more.

Share this post


Link to post
Share on other sites

Thank You very much, I was waiting for this kind of anwser. I will render triangle in both and i will see what I like more.


I don't think rendering a single triangle means much. Rendering a single triangle in OpenGL is extremely simple compared to DirectX (as far as I know), but that really doesn't mean anything in the long run, so don't judge by it.

Share this post


Link to post
Share on other sites
The point of rendering a single triangle is to just determine how comfortable the OP is with the general structure and usage of the API. In actual fact, using VBOs and shaders, the D3D code needed is something like 4 lines whereas the GL code is nearer 20 or so. Without VBOs and shaders the D3D code comes in at maybe 3 lines (init the data, set the FVF, DrawPrimitiveUP). The old perspectives on this are not really valid anymore.

Share this post


Link to post
Share on other sites

The point of rendering a single triangle is to just determine how comfortable the OP is with the general structure and usage of the API. In actual fact, using VBOs and shaders, the D3D code needed is something like 4 lines whereas the GL code is nearer 20 or so. Without VBOs and shaders the D3D code comes in at maybe 3 lines (init the data, set the FVF, DrawPrimitiveUP). The old perspectives on this are not really valid anymore.


What about initialization, matrix setup, etc? And I'd guess the the OP would use immediate mode stuff, but maybe I misunderstood. Anyway, I still don't think a single triangle would be a good way to judge the comfortableness of the API:s. But I may be wrong.

Share this post


Link to post
Share on other sites
Well it's more about coding style which seems to be the OP's primary concern. I'm thinking that a relatively short program should be sufficient to determine if the D3D style is completely objectionable or not.

Init in D3D9 is roughly the same amount of code as in GL, by the way. Matrixes can be slightly more; D3D9 does have a matrix stack interface which matches GL's more or less exactly, but you do also need an explicit SetTransform call.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!