OpenGL or DirectX?

Originally posted by MrShoe:
Just look at a game like UT, then run it in OGL and then in D3D, you decide.

UT (Unreal Tournament) was designed around the glide format of 3dfx. It was the ported to D3D and OpenGL. So this is a bad app to use as a comparison.

Perhaps you should look at something like Quake3 Arena. This was done in OpenGL and had better polygon capability than the Unreal engine ever did. Another major difference however was that the Unreal Engine was easier to mod than the Quake engine. Whether that was because of tools developed to do so within the app or the framework of the engine is not clear to me since I haven’t done any modding on them.

Now I’m not sure if the reason Quake had better polygon capability was because of the choice of API (OpenGL) or because Carmack is just a better programmer or what. But the fact remains that the Quake 3 engine does allow for more polygons on screen at one time with great framerates, so long as you ran it on an NVidia card which suported OpenGL properly unlike the ‘hack’ MiniGL drivers 3dfx supplied to their users in the beginning.

boy that was a long rant sorry.

I think that question “What is better?” has very limited sense. DirectX is Windows-integrated, OpenGL is not, but try use your OpenGL windows exe file on other platform :slight_smile:

DirectX and Direct3D as a part of it was designed for game programming under windows, OpenGL was not. As for me, I think, that the choice between these is subjective, and if hardware manufacturers give us both models, why not use them both?

discussions like this will never end until the fat lady sings. Why even bother? I started using directx but turned too OpenGL because of portability. newbie game programmers tend to use DirectX cause it´s a package, everything you´ll ever need is allready there. This discussion will be even worse when OpenML is released…

FYI the reason Unreal is so slow at hardware rendering is that it uses lots c-buffers and other CPu consuming stuff to reduce overdraw. Might speed stuff up with software rendering or a vodoo 2 but on anything more advanced it becomes hopelessly CPU-limited.

I like OpenGL better than Direct3D for a number of reasons. You should note, that even if you use OpenGL for graphics, there is nothing to stop you from using other things in DirectX like DirectInput, DirectSound, and DirectPlay. My advice would be to spend some time learning OpenGL, and when you feel comfortable with the basics, at least take a look at Direct3d and draw your own opinions. Many people find OpenGL easier to learn. Others find Direct3d easier to learn. It’s all a matter of opion.

Even though I prefer OpenGL, you have to admit that the advent DirectX did a lot for the gaming industry on the Windows platform.

Yes, it certainly did. I think that there are a few reasons many people use DirectX over OpenGL. Part of it is that it is now an integral part of Windows, and it would seem that Windows would favor it for speed instead of OGL. Second, DirectX code is somewhat easier to read and more organized, and already containts functions for handling all the math involved in programming, like matrices and sorting. Those are things that many developers are too lazy to handle themselves. Descent 3 is very good in this manner though… I love that game, and its moddability makes it all the more fun. Too bad it’s Glide optimized… anybody got a hell of a good wrapper?

D’OH! Sorry But seriously, OpenGL does provide more control of things, and I like the extension system in it.

Originally posted by Michael:
What are the advantages and dis-advantages to using one over the other? And which one is easiest to learn for a complete newbie? Thanks!

Of course, OpenGL is better than DirectX. I have both SDKs, and I prefer the OpenGL one better, so let me explain why.

>What are the advantages and disadvantages to using one over the other?

OpenGL supports more languages. Ada, Fortran, C, C++, Java, Visual Basic (which isn’t really a language, it’s more like a toy) and that’s just the short list. DirectX only supports Visual Basic and C++.

OpenGL is cross-platform, meaning if you write your code a certain way, it will compile on almost any machine minus Unix. DirectX will only work on some versions of Windows. Microsoft has problems getting DirectX to work on their own Windows 2000 :slight_smile:

DirectX is FAT; if you’ve ever been to the download page, it’s a HUGE 141MB download, for the 8.0a SDK. Even people with cable modems have problems downloading this. How about OpenGL? I can just use the stuff that comes with my compiler to create OpenGL apps. Note that they do have a partial download site, but just for the C++ portion of the DirectX 8.0a SDK takes up 55MB.

The DirectX board, also known as the MSDN Online User Comments, SUCKS; there are more anti-MS comments on there than there are helpful comments. People usually spend the time flaming each other, or are trying to convice others to use Linux or OpenGL or Borland rather than saying something that has value. The OpenGL Discussion & Help Forums is just great, since people do remain civilized here.

Like DirectX only works on their operating system, it also only compiles on their products. You can only get apps that use DirectX 8.0 to compile on either Visual Basic or Visual C++. I can get OpenGL to compile on the Borland command prompt tools, which is an advantage, meaning you don’t have to blow your money on a piece of crap MS product to use it.

>which one is easiest to learn for a complete newbie?

Hmm…OpenGL. I use NeHe’s tutorials myself. Have fun.

Well said rpxmaster.


Originally posted by rpxmaster:
OpenGL is cross-platform, meaning if you write your code a certain way, it will compile on almost any machine minus Unix.

should be…

OpenGL is cross-platform, meaning if you write your code a certain way, it will compile on any machine.

You seem to forget that SGI machines are unix based.

Here is my quick take on OpenGL vs. Direct3D:

Both of them have their advantages and disadvantages. They are just tools though. Just learn what you want and implement your ideas using it. If it isn’t sufficient or your mind isn’t geared towards it, then switch to another tool. As long as you complete your objective, it’s just a tool.

Now that the zen talk is out of the way…

OpenGL is cross-platform and simple.
Direct3D is cross-platform only within Win32 and is not very simple to use for the typical programmer. Direct3D 8 is a vast improvement over Direct3D 7, but still.

I would learn both. Just because I want the most tools at my disposal. X-Box is going to use Direct3D. Direct3D drivers are generally more mature also (nVidia is the exception, their drivers are probably the most mature drivers for consumer hardware).

In closing, realize that OpenGL is just a specification and standard. It’s the implementation that actually determines the quality of the tool and how ideal it is in terms of the standard. Direct3D is controlled by Microsoft, hence they have absolute control over it and can do whatever they want. OpenGL is controlled by a board and any “Extra” features are implemented through extensions.

Use whatever you feel can finish your project.


PS. People say that OpenGL is an old and outdated standard. No, it’s a solid standard that will be guranteed to work (that’s why it’s older). Any extra features are implemented through extensions. So it gives the hardware vendor more control over how their extension is implemented and the developer may take advantage of these. How is this accomplished in Direct3D?

The Perfect blend:

OpenGL with DirectInput and DirectSound

'nuff said.

When I began programming using the 3D APIs I bought a book on both OpenGL and Direct3D and from what I can tell OpenGL is by far the easiest to learn with. There exist two reasons for this:

  1. Initialization of OpenGL is very easy.
    You can write a simple OGL program in less than 20 lines; it doesn’t do much, but it works and shows a triangle or something. I have never seen a Direct3D program come close to 20 or even 100 lines. Even using the wrapper classes provided in the SDK fail to make D3D easy.
  2. OpenGL is more flexable.
    As I understand it everything that can be done in OGL can be done in D3D (or at least almost everything) with similar performance results. However, the complexity of implementing these features (for me) is dramatically different. OpenGL’s simplistic glEnable() and other functions allow incredible flexability in the rendering of just about everything. Direct3D on the otherhand… well its a lot of work (to me at least) usually involving the filling of some giant structure to envoke the simplest things (Like a rendering surface). Needless to say I prefer the OpenGL simplicity, allowing me to control program opperation rather than the other way around.

As a side note:
I believe that in a full professional program (like a game or something) D3D and OGL are perfectly acceptable. D3D is probably better if the program needs to run on old non NVIDIA hardware and OGL is probably better for audiences with more modern hardware. Furthermore D3D’s complex program structure is of little consequence in a large program taking away one of OGL major benifits (at least as I see it)

So in answer to the original question:
OpenGL is most likely (unless your crazy about structures and wrapper classes) the easier API to learn. OpenGL is perfect for small programs to learn 3D programming where D3D becomes chaotic.

P.S. I am not really qualified to make any sort of credible statements about OGL and D3D because I have never written much of anything except a couple of side scrolling games, so take my opinion with a grain of salt (or a bag)

Not meaning to be rude, TheHero, but did you see when this question was posted? 14 months ago!! I’m pretty sure the original poster would have decided by now which API to use!

Can we please let this discussion die? I know it will always come up again and again but it is such a useless religious war. Obviously people on this board will support OpenGL and people on a DX board will support DX.