DirectX vs OpenGL

BlitzMax Forums/BlitzMax Programming/DirectX vs OpenGL

BLaBZ(Posted 2012) [#1]
What's the purpose of Max2D codes working with both opengl and directx when OpenGL works on all platforms?

Thanks


Oddball(Posted 2012) [#2]
OpenGL is not as well supported as Direct3D on Windows machines. You will often find that Direct3D performs better than OpenGL.


xlsior(Posted 2012) [#3]
Specifically: on low-end windows machines DX tends to perform better, sometimes significantly. On high-end machines you'll find little difference.


Floyd(Posted 2012) [#4]
As I recall "OpenGL for everybody" was the original dream of BlitzMax, which was released first on MacOS. When the Windows version came out there was all sorts of trouble. The better graphics cards were usually intended for game machines, so they had to support OpenGL to run the more demanding games.

But as you moved down the graphics card food chain the OpenGL drivers got worse. The drivers not only lacked certain features they sometimes lied about their own capabilities. Eventually BRL had no choice but to add support for Direct3D, which is the standard for Windows.


Captain Wicker (crazy hillbilly)(Posted 2012) [#5]
OpenGL is faster than DirectX, I prefer OpenGL for that reason
OGL is less stable than DX though ^_^


DaY(Posted 2012) [#6]
OpenGL might be faster but on most hardware that the public use DX9 is better as its more widespread.

Making ur game XPlatform is all nice and well but as 70-80% of ur market as a indie dev is windows you go with what runs best on most hardware not just some.


JoshK(Posted 2012) [#7]
as you moved down the graphics card food chain...
most hardware that the public use...
on low-end windows machines...
not as well supported...

=Intel integrated graphics chips.


DaY(Posted 2012) [#8]
yep or there really crap 30-40pound gfx cards they throw in with bundles, unless you plan to make the next uber fps or rpg and have to be on all platforms use dx.

or better still go xplatform but run checks to see the O/S and activate the Render you need DX windows - opengl linux mac


Captain Wicker (crazy hillbilly)(Posted 2012) [#9]
=Intel integrated graphics chips.

AMD/ATI Radeon HD is better for me

DX9 is better as its more widespread

DirectX = Blitz3D (Windows Only)
OpenGL = MiniB3D + BlitzMax (Linux, Mac, Windows)
hmm, I would think going cross platform would be more "widespread"


SystemError51(Posted 2012) [#10]
OpenGL is faster than DirectX, I prefer OpenGL for that reason


I think you meant Direct3D. DirectX is a framework that encompasses a lot more things than just gaming specific. DirectX is also an API to write normal applications with.

On Windows platforms, Direct3D is in fact faster than OpenGL. So that's a pro - right? However using Direct3D will limit you to Windows. You will not be able to publish your games on any other platform.

OpenGL on the other hand has clear performance superiority on the other platforms compared to Direct3D.

So... I think the smart choice is to put in a junction in the beginning of your code that determines on which platform you're on. If it's Windows, use Direct3D. Anything else uses OpenGL.

It's not a problem since the API calls of Direct3D and OpenGL are pretty much identical.

This way you get the best of both worlds.


// EDIT

I also like to mention that OpenGL is a free, cross-platform implementation - DirectX/Direct3D requires a costly Windows license.

Last edited 2012


col(Posted 2012) [#11]
Hiya,


DirectX/Direct3D requires a costly Windows license.



DirectX and all its APIs, SDKs and runtime libraries are all free to download from Microsoft. You can freely distribute them along with anything you've created using them. The main part of the license agreement regarding to distribution is that you distribute the same version of the libraries that the app was built with, to uphold consistency and ensure the app will work correctly on the end users machine.


col(Posted 2012) [#12]

or better still go xplatform but run checks to see the O/S and activate the Render you need DX windows - opengl linux mac



Max2D already does this due to the way the graphics drivers are initialised. When on a windows machine it will default to DX9 or DX7 if DX9 isnt installed or fails (EDIT:- or OpenGL is theres no DX at all - unlikely ), other OSs obviously wont have Dx so they default to OpenGL.

This happens well before your first line of code.

Last edited 2012


SystemError51(Posted 2012) [#13]
DirectX and all its APIs, SDKs and runtime libraries are all free to download from Microsoft.


You still need a costly Windows license to use those with (as in, well, Windows itself). That's what I meant.

Last edited 2012


Oddball(Posted 2012) [#14]
Yeah, and you have to pay costly electric bills when using Direct3D, and that Mountain Dew that your drink whilst using Direct3D isn't free either. Oh, and don't forget the house that you need to house your computer, they don't grow on trees you know.

What a ridiculous statement. You do realise that to use OpenGL on a Windows machine you have to have bought Windows. You don't get it free if you are only going to run OpenGL on it.


Noobody(Posted 2012) [#15]
OpenGL does "work" on all platforms, but the problem is that certain Windows drivers don't really implement the full standard or at least don't perform very well.

nvidia drivers are usually pretty good, but ATI drivers have been known to be notorious for lying about OpenGL capabilities and being plain slow. They have been getting a lot better over the last few years, but it's still a problem with older cards. Direct3D on the other hand will usually run alright on both.

For example, the game I'm making constantly crashed on one of the artists' machine. Turns out that the program doesn't even get an OpenGL context (GLGraphics fails) due to a combination of crappy drivers and old graphics card.
The only solution was to add a DX9 backend to the engine, which ran perfectly fine.

So yeah, having an additional Direct3D implementation is by no means a bad thing - I was actually pleasantly surprised there's one available for Max2D. It's usually the best choice on Windows.


SystemError51(Posted 2012) [#16]
The point is that you need to pay for Windows first to get those speeds, and it limits you to only one platform.

I think I go with the free one that includes me using it on Windows without license restrictions.

Geez.


DaY(Posted 2012) [#17]
LOL SystemError

you do know again 70% of pc's sold come with windows pre installed or the fact its only 80 quid to buy.

oh and being limited to one platform, that one platform sells far more copy's than ur free o/s.

only an idiot makes a game that wont work on a good 50-69% of the market who might buy it as proper gamers wont.

you want proper gamers with good hardware build the next wow or cod if you create indi games learn to respect most people buy crap pc's with windows.

oh and cap n wick
it does not matter if your game can run on 3 platforms if you make a good game and people want to buy it you will sell mostly windows, i find linux users are to used to free and dont like to buy stuff as often ;-)

Last edited 2012


jsp(Posted 2012) [#18]
When on a windows machine it will default to DX9 or DX7 if DX9 isnt installed or fails (EDIT:- or OpenGL is theres no DX at all - unlikely )

Just as a side note, using Windows in a VMWare image supplies you only with OpenGL drivers.


SystemError51(Posted 2012) [#19]
you do know again 70% of pc's sold come with windows pre installed


I do, of course.

or the fact its only 80 quid to buy.


I don't | think | so.

it does not matter if your game can run on 3 platforms


Maybe not to you.

Last edited 2012


JoshK(Posted 2012) [#20]
Just as a side note, using Windows in a VMWare image supplies you only with OpenGL drivers.

Hilarious.


Yasha(Posted 2012) [#21]
The main part of the license agreement regarding to distribution is that you distribute the same version of the libraries that the app was built with


This explains why games are always being so dashed annoying about distributing versions of things I already have... huh.


you want proper gamers with good hardware build the next wow or cod if you create indi games learn to respect most people buy crap pc's with windows


What if we want artistic and creative integrity?


DaY(Posted 2012) [#22]
i do think so

http://www.overclockers.co.uk/showproduct.php?prodid=SW-127-MS

just coz you look in stupid places don't mean we all do


DaY(Posted 2012) [#23]
that's the point yasha you can make stuff look good with dx9 that will work on most pc's and it will still be as fast than opengl on the same hardware due to drivers and support


SystemError51(Posted 2012) [#24]
just coz you look in stupid places don't mean we all do


You're da boss man, what you say is the law. Amazon is stupid, I'm stupid, we're all stupid, but you... YOU are ALWAYS right. Whoever dares to question your word must perish from the face of the Earth, yes?

Wow are you an original.


// EDIT

72.00 GBP = 116.264 USD

So it's not entirely affordable for everyone.

Last edited 2012


DaY(Posted 2012) [#25]
well know you are making ur self look stupid and not only that acting about 12

oh and if some one cant afford that amount chances are there pc wouldn't be able to play ur game anyway.


Captain Wicker (crazy hillbilly)(Posted 2012) [#26]
I think you meant Direct3D

I think I did too :/


SystemError51(Posted 2012) [#27]
well know you are making ur self look stupid and not only that acting about 12

oh and if some one cant afford that amount chances are there pc wouldn't be able to play ur game anyway.




Last edited 2012


DaY(Posted 2012) [#28]
wow great comeback!

i guess were you are from hardware is free and every one buys new pc's with out o/s pre installed...

even most ebay pc's come with windows on or if you build it ur self witch is mostly the gamer types they will get windows to play there games.

so i say again if they cant afford the price of windows they would not have a good pc in the first place very rare do you find people building a top spec pc to stick linux on..

OpenGL is nice but as a INDIE dev your game will not be bought by pure gamers but by casual or if its pop cap type (match 4)then by house wives etc and they dont give a damn if opengl runs on there windows box or not so they use mostly on board intel gfx so its better to go DirectX on windows.

Last edited 2012


SystemError51(Posted 2012) [#29]
Whatever dude, whatever.

Last edited 2012


Captain Wicker (crazy hillbilly)(Posted 2012) [#30]
LOL!


BLaBZ(Posted 2012) [#31]
@Day graphics API isn't going determine who buys your game.

A lot of graphics cards have been optimized to run with DirectX and I'm seeing that DirectX is generally faster but only by a few frames.

As for capabilities, I haven't seen anything DirectX can do that OpenGL can't or vice versa.


DaY(Posted 2012) [#32]
the point is most hardware that people in the casual section of gamers normally have low end cards or on board gfx witch don't run opengl that well due to poor drivers so the better bet is to run directx on windows machines for better compatibility and better speed on lower end machines.


xcessive(Posted 2012) [#33]
I can't stress this enough.

I want. OpenGL and Direct3D. To die. In a bin.

Screw pipeline rendering, give me more cores and I'll write my own pipeline or use a library that does so. Or better yet, give me an implementation of a functional language as a shader language--none of this imperative bulls--t that restricts parallelism. OpenGL and Direct3D suck, they both force you to use a massively outdated pipeline architecture based on forcing polygons and local lighting down your throat. Also, they are a nightmare to use in multithreaded engines; although I've only had experience with OpenGL in multithreaded environments, to be fair, direct3d might be better than expected.

I mean... yeh, they are great for simplifying the complex parallel matrix manipulation being done. But, given full access to a programmable GPU, any moderately talented graphics programmer could re-write their own implementation and use /whatever they want/ as the rendering architecture. We would start seeing more raytracing, radiosity, voxel rendering and hybrids, given a few years.

[commence people flaming me]

Last edited 2012


Noobody(Posted 2012) [#34]
But, given full access to a programmable GPU, any moderately talented graphics programmer could re-write their own implementation and use /whatever they want/ as the rendering architecture.

Well, you have full access. That's what the entire GPGPU craze is about.

GPUs nowadays aren't just tailored to polygon rendering - they're mostly just a bunch of streaming multi-processors with their own memory architecture (plus some additional logic for texture lookups and rasterizing) which are fully programmable with CUDA or OpenCL (which really just are C with different memory managament). If you want to implement your own rendering method - go for it! I just think you'll find that the "every moderately talented graphics programmer can do it" part of your statement won't hold true. Solving the inherent problems of polygon- (yuck) or voxel raytracing methods are still part of ongoing research.

OpenGL and Direct3D suck, they both force you to use a massively outdated pipeline architecture based on forcing polygons and local lighting down your throat

Have you even had a look at recent API versions? OpenGL 3.0 dropped absolutely everything related to the (legacy) fixed function pipeline. What you now do instead is allocate memory buffers inside the VRAM, specify the memory layout and define programs that act on them (i.e. custom vertex- and fragment shaders are now mandatory). It's now a lot more difficult to write generic engines for it, but you can't tell me the API is outdated - it perfectly reflects the underlying hardware.

Now, you might say that the hardware design is outdated (and I might even agree with you), but that's not the fault of OGL or D3D ;)


AdamRedwoods(Posted 2012) [#35]
http://blog.chromium.org/2010/03/introducing-angle-project.html
when complete, it will enable browsers like Google Chrome to run WebGL content on Windows computers without having to rely on OpenGL drivers.



SystemError51(Posted 2012) [#36]
I want. OpenGL and Direct3D. To die. In a bin. [...]


You're obviously free to create your own 3D API. If you do, make sure that it outdoes OpenGL and Direct3D. Show that API to us, we'll have a go, and then we talk :)

As mentioned before, I suggest you read up on OpenGL 3 and 4 before assuming nothing has changed.