OpenGL or DirectX?

Started by
22 comments, last by Kylotan 16 years, 10 months ago
Quote:Original post by programering
In my opinion I think DirectX is more complex than OpenGL. DirectX have many different versions(I mean that there is 7.x, 8.x or 9.x, etc...) and it's built upon you have to create object devices (tag struct's). But in OpenGL there's just one main version of it, it's basically just global function calls except for some objects.


One could probably argue that Direct3D is more complex than OpenGL, but not for reason of versioning. While it's true that there are several versions of Direct3D, the same is also true of OpenGL, which has gone through versions 1.0, 1.1, 1.2, 1.3, 1.4, 1.5 and 2.0 with 2.1 and 3.0 on the way before the end of the year. Its generally true that point revisions are backwards compatible, and that GL point revisions are more frequent and perhaps more drastic than Direct3D point revisions. One could argue that OpenGL, with its extension mechanism, is actually more complex to deal with than Direct3D's versions, though they're probably equal with the realities of the Cap Bits mechanism up through D3D 9. Direct3D has gone through 7 major revisions (Direct3D 3, 5, 6, 7, 8, 9 & now 10) compared to OpenGL's current 2 (though you could argue that the addition of shaders was a big enough addition to consider it a new (but backwards compatible) version).


Quote:Original post by programering
Check this out: http://www.xmission.com/~legalize/d3d-vs-opengl.html


A comparison of OpenGL 1.2 to Direct3D 7 and 8 (The former of which sucked, and the later of which sucked less) is hardly relevant any more.

Quote:Original post by TheUmpteenth
The PS3 uses OpenGL-ES, (ES is for Embedded Systems) whereas the XBox 360 uses (no surprises here) DirectX 10.


Niether point is quite on-target.

The PS3 supports 2 low-level 3D APIs, Most AAA games now are using the lowest-level API called CTM (Close To the Metal) which is basically a software API which accesses the nVidia Graphics hardware with very minimal abstraction, the second API is called PSGL, which is based on, but is clearly not, OpenGL|ES. The reason PSGL differs from OpenGL|ES is that OpenGL|ES (in version 1.x at the time) did not yet have provisions for vertex or pixel shaders, which the PS3 supports, and there's little use for the fixed-point functions on such powerful hardware, which AFAIK were removed. Sony used ES as a base, but signifigantly tweaked it for their needs. Its probably just as accurate to call PSGL a stripped-down OpenGL than it is to call it an expanded OpenGL|ES. OpenGL|ES 2.0 now exists and includes shader support using GLSL (as opposed to Cg in PSGL), Sony has said that they would create a PSGL 2.0, based on OpenGL|ES 2.0 and GLSL, if enough developer interest was shown.

The 360, on the other hand, does not use Direct3D10 as its base API either. I'll refer to it as X3D for lack of a better name. Its very much an analogue to PSGL in many respects: PSGL is to OpenGL|ES as X3D is to Direct3D 9. They took Direct3D 9 and tailored it to their hardware by cutting out what they don't need and adding what they did. Feature-wise, it sits somewhere between Direct3D 9 and Direct3D 10, its shader support goes beyond 3.0, but does not meet 4.0 in all areas; there are no geometry shaders, for instance. Both X3D and PSGL are console-tuned versions of their parent APIs; the love-child of each console and their respective API legacies.


Anyhow... Back to the original question. Which is better? The answer is impossible to provide. While they accomplish the same task, the syntax is quite different and the APIs are running neck-and-neck in terms of features, as they have for some time and will likely continue to do. Frankly, the best idea is to try both out and see which one jives with your personal preferences. Most newbies are more comfortable with OpenGL's C-based API, since its not hidden away behind layers of C++ classes and interfaces like Direct3D is. Once you get over that hurdle, you might actually like the way D3D is arranged. Try them both, and as other's have said, learn the fundamentals. The future may hold something entirely different, Real-time ray-tracing for instance, and a whole new API to go with it. APIs come and go, but fundamentals are forever.

throw table_exception("(? ???)? ? ???");

Advertisement
I like OpenGL myself because it's so easy to use straight out of the box. You can build a quick application easily within an hour.

I also like their matrix stack implementation, and other 'utilities' (glu). But many things aren't supported natively with openGL. DirectX has extensions to support basic quaternions, vectors and matrices for example. Also, DirectX caters for audio, music, inputs (steering wheels, joypads...). There are many 3rd party libraries you can use to work with openGL and provide all that functionality, or you can even use DirectInput or audio directly with it as well.

All in all, I don't think it matters. It depends on the books, platform, development environment, language, ect... Will you be working with XNA? C++? C#?...

Everything is better with Metal.

I am pretty sure the FAQs directly forbid this type of post, but since it is all nice and polite I guess it doesn't matter...

Really, it is comes down to one pragmatic reality: OpenGL runs pretty much everywhere except the XBox, and Directx is only available on Windows and XBox. If you can live with only Windows, then it is purely a matter of personal choice, give them both a spin, check out sample programs for each, and go with whichever you like better.

It is also worth mentioning that DirectX compromises a lot more than OpenGL (which is functionally equivalent to only Direct3D), so with OpenGl you will need to learn a few other APIs in addition.

And DarkHorizon is right, unless you feel a burning need to learn how to initialise a window in 10 different APIs and hand code coloured triangles, you may as well start out with something substantial, and preferably higher level, such as CrystalSpace with CELstart.

If you do intend to start from the bottom, then you will probably have to learn both sooner or later, and anyway, APIs are simple to learn compared to, say 3D math or script-compilers :)

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Yeah, I think this has run its course.

This topic is closed to new replies.

Advertisement