DirectX 9.0 vs OpenGl 2.1

Started by
15 comments, last by Tachikoma 12 years, 10 months ago
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?
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.
Yeah that is one way to do it but what baout that difference between DirectX 9.0 and OpenGL 2.1?
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.
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?

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

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.

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.
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.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.


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.
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.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement