DX or OpenGL ?

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
binbinhfr
Posts: 78
Joined: May 9th, 2019, 10:57 pm

DX or OpenGL ?

Post by binbinhfr » April 18th, 2020, 5:34 am

Hi guys,

for my little game, I use SDL2, and I'm looking for a GUI (trying to make ImGUI or NanoGUI work, but Cmake is a pain in the ass when it comes with no explanation...).

But my question is : what can make me choose between DX or OpenGL. It seems that SDL2 accepts both of them, depending on the type of Renderer you open. And it seems that there are some implementation fo ImGui or NanoGui for DX and OL too...

I'm planning to develop the game for Windows (7-10). So What is the best choice ? Does any window compatible graphic card accept both standards ? Under windows, is one of them faster than the other ? In other word, what are the pros and cons of each solution ?

Thanks and have a nice day !

albinopapa
Posts: 4145
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: DX or OpenGL ?

Post by albinopapa » April 18th, 2020, 11:09 pm

DX is mostly Windows specific though with Linux you have the Wine API that allows some games to run using backwards engineered Direct3D libraries. So it's a good chance that using DX9 features the game will run on Windows natively and Linux running through Wine. OpenGL on the other hand runs on most platforms natively and lots of people say it's easier to interact with than D3D anyway.

As far as performance, I'd say it wouldn't matter unless you are trying to push a lot of polygons through the renderer.

If it's multi-platform you are after then go with OpenGL, but if you don't care about all that, then you can just stick with DirectX.

As an aside, I didn't realize SDL2 had a D3D renderer, that's kind of neat.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

binbinhfr
Posts: 78
Joined: May 9th, 2019, 10:57 pm

Re: DX or OpenGL ?

Post by binbinhfr » May 11th, 2020, 8:17 am

Hi, thx @albinopapa !
Sorry for the delay. The confinement induces some lags in real life... :-D
Finally, I switched to SFML, because SDL2 is quite poor in terms of graphics.
And on top of that, I use ImGui which is very nice.
SFML uses Open GL, so the choice is done ;-)
Note that both libraries are made by french guys !!! Easier or me to interact, even if their forum is in english, of course... ;-)
If you don't know them :
https://www.sfml-dev.org/index.php
and
https://github.com/ocornut/imgui

and for your eyes only ;-) , a little screencopy of the game at its current status...
https://imgur.com/a/houvcnL

albinopapa
Posts: 4145
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: DX or OpenGL ?

Post by albinopapa » May 12th, 2020, 1:14 am

Pretty familiar with the SFML api, but DearImgUI is something I didn't know about until chili started using it in the Hardware 3D series and I still haven't checked it out.

I didn't realize SFML offered more in the way of graphics, I figured it was the same as SDL2 with the difference being SFML used C++ instead of C.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

binbinhfr
Posts: 78
Joined: May 9th, 2019, 10:57 pm

Re: DX or OpenGL ?

Post by binbinhfr » May 12th, 2020, 6:46 am

SFML has a lot of graphics tools for texture, sprites, and all 2D stuff. But nothing for 3D : you have to code in OpenGL directly, but SFML does teh "preparation".
Dear ImGui is really nice. You should have a look at it.

Post Reply