What are the advantages over DirectX?

BlitzMax Forums/OpenGL Module/What are the advantages over DirectX?

G-Lyst(Posted 2008) [#1]
I heard of OpenGL, but never tried coding for it. What are the advantages of OpenGL over DirectX?


ImaginaryHuman(Posted 2008) [#2]
Gee, that's a big question. I don't know much at all about DX. OpenGL is supported on many many hardware platforms whereas DX is Windows only. You can't do cross-platform using DX only, but you can do cross-platform using GL for other platforms and GL or DX for Windows. One downside is there may not be a good GL driver automatically installed on Windows, requiring a user download. Macs come with good GL drivers right out of the box. Linux has GL too but you have to go find it and install it.

Installation and compatibility aside, I personally like GL, partly because Microsoft has little to do with it but moreso it's perhaps more elegant than DX. Talking out of my a. GL may or may not be faster than DX on some drivers/hardware.


Beaker(Posted 2008) [#3]
You don't actually need to program any GL to use it, just switch the driver for Max2D. The only real reason you might want to use it is if you plan to target Apple Macs or Linux computers.


Who was John Galt?(Posted 2008) [#4]
GL api's have to pass a wider set of performance tests, ensuring more reproducibility of visual effects across different hardware. If you are programming the API directly, some would argue OpenGL is easier to use.


xlsior(Posted 2008) [#5]
I heard of OpenGL, but never tried coding for it. What are the advantages of OpenGL over DirectX?


The main feature of OpenGL is that it's cross-platform: DirectX is a microsoft technology which is only available for Windows. OpenGL is functionally very similar in what you can (and can't) do with it, and is the primary technology used by non-Microsoft operating systems like Linux and OSX.
One advantage of using OpenGL is that it makes the code easier to compile across platforms.
When BlitzMax was first released, it was OpenGL only without DirectX support at all. The DirectX module was added later after it became evident that OpenGL speeds were really sub-par on some videocards under windows, thanks to their crappy drivers. (Especially on some of the embedded graphics chips which weren't created with gaming in mind in the first place, and where OpenGL support really was the ugly red-headed stepchild)

Under Windows it defaults to DirectX now (which has slightly better performance on many systems), MacOS and Linux default to OpenGL.


Taron(Posted 2008) [#6]
I believe that openGL ended up being the ugly red headed stepchild within Blitzmax as well... having noticed a few troubles with the vertical blank on at least one very common laptop gfx board. I was too excited about finding the solution by using directX, that I skipped checking if it was only with MaxGui compiles or any, but I somehow think it was maxGui related, too. For sure I can therefore say: Big NO NO on openGL with Maxgui, if you are planning to do any fps sensitive applications...like a game! ;)


dmaz(Posted 2008) [#7]
if you have an nvidia card you're better off with opengl. ati/amd and intel, you're better off with dx9 but dx7(blit'z default) will often get you poorer performance.

nvidia's opengl driver seems to be quite superior to it's and everyone else dx driver.

this is just been my experience testing wide variety of cards.


KimoTech(Posted 2008) [#8]
I would say, that to some purposes, OpenGL is best, and for some, Direct3D is best.

For example, in Ogre, most of the demos run with 10-20% better performance in Direct3D mode, but i don't know why.

I've also experienced, that OpenGL is very vendor-specific, because of all the vendor-specific extensions etc.

For example, the Leadwerks engine had a lot of problems on some specific cards once ago, don't know if the problems has gone away now, but if you use the Direct3D API, you're almost good to go on the most hardware which is compitable with a specific shader model.

Even if you switch to Direct3D10, almost all the graphics cards has got the same functions.

If it's up to me, i would use Direct3D on Windows, and OpenGL on other platforms.


MGE(Posted 2008) [#9]
OpenGL scares me on Vista from the tests I've done. Like others have said, DX on windows, OpenGL on Max/Linux.


plash(Posted 2008) [#10]
@dmaz: Strange.. I almost always get better performance with OpenGL with my ATI card.


ImaginaryHuman(Posted 2008) [#11]
I don't think there's going to be an exclusive rule as to whether GL or DX is better all of the time. Sometimes in some situations one is better than the other for various reasons.