Why only OpenGL and Vulkan in the Linux world?

Debian_SuperUser

Active Member
Joined
Mar 18, 2024
Messages
136
Reaction score
33
Credits
1,606
Wind**s has a huge software stack optimized for adding additional overhead any type of rendering weather that be complex computer graphics or simple 2D rendering using native Windows GUI API commands. And as far as my knowledge goes, most of the Linux world just uses OpenGL in the backend and only newer implementations using Vulkan? These both are capable of advanced 3D graphics, and OpenGL is very old, less performant and high CPU overhead.

I don't have that deep knowledge of how graphics rendering works in Windows and Linux, but I have a strong feeling that Wind**s has the proper architecture for every type of rendering, such as I think Windows GDI or Direct2D, and these are mostly abstracted using higher level libraries.

Even Android, backed by Google, mostly uses OpenGL ES and Vulkan for everything, and on the Apple side, they just have Metal for everything, no matter 2D or 3D.

So just using OpenGL and Vulkan isn't as bad as it sounds? Despite their higher capabilities, they are optimized enough to run everything else such as 2D graphics and act as the main display server?

EDIT - I wanted to add on that I admire the Linux world all the low level stuff is written in pure C/C++. No .NET, XAML, Javascript, bs. Just pure C/C++. Good and optimized. But then you hit the userspace where developers just can't put that much time, and have to use higher level languages. Now I don't exactly know what all higher level languages are being used (like maybe JS and CSS, and I have heard many other libraries, which some of them actually compile down to C/C++?), but I now Python is one thing that is heavily used in the Linux world and has no usage in Windows. Linux is just built with all the open source and already available stuff, rather than creating their own software, which is why OpenGL and Vulkan might be popular.
 


Wind**s has a huge software stack optimized for adding additional overhead any type of rendering weather that be complex computer graphics or simple 2D rendering using native Windows GUI API commands. And as far as my knowledge goes, most of the Linux world just uses OpenGL in the backend and only newer implementations using Vulkan? These both are capable of advanced 3D graphics, and OpenGL is very old, less performant and high CPU overhead.
Unlike DirectX and OpenGL, Vulkan is low level graphics API taking advantage of modern GPU's resulting in better performance.

OpenGL is old and it's OK to say that Vulkan is its replacement.
DirectX is Windows only and dominates Windows games, Vulkan is platform agnostic as well as OpenGL.

but I have a strong feeling that Wind**s has the proper architecture for every type of rendering, such as I think Windows GDI or Direct2D, and these are mostly abstracted using higher level libraries.
Game engines are examples of higher level libraries that utilize graphics API's.
Otherwise it's not needed to use higher level library, you can write a game solely by using graphics API's, e.g. custom engine without boilerplate and adjusted for your game.

So just using OpenGL and Vulkan isn't as bad as it sounds? Despite their higher capabilities, they are optimized enough to run everything else such as 2D graphics and act as the main display server?
OpenGL is used only because a lot of existing code uses it, however IMO OpenGL is dead for new development and frameworks.
If I'd write a game engine I'd stick to Vulkan only because it's the newest and giving you the most control of all 3.

EDIT - I wanted to add on that I admire the Linux world all the low level stuff is written in pure C/C++. No .NET, XAML, Javascript, bs. Just pure C/C++. Good and optimized. But then you hit the userspace where developers just can't put that much time, and have to use higher level languages. Now I don't exactly know what all higher level languages are being used (like maybe JS and CSS, and I have heard many other libraries, which some of them actually compile down to C/C++?), but I now Python is one thing that is heavily used in the Linux world and has no usage in Windows. Linux is just built with all the open source and already available stuff, rather than creating their own software, which is why OpenGL and Vulkan might be popular.
You got a lot of things wrong, Python is used on Windows as well, comparing it to .NET and similar MS BS makes no sense because the 2 are not very much related.


There is a lot of languages, hundreds of them, with C and C++ being most popular for games.
Graphics API's like Vulkan are compatible with C/C++ out of the box while various other languages require their own libraries.

There is too much to tell you everything, I suggest to read detailed articles step by step, e.g.:


This one is great for understanding even if you don't plan to make games:
 
@CaffeineAddict

You didn't get my point. OpenGL and Vulkan have capabilities for rendering complex 3D graphics. Is it a good thing to use them for simple 2D graphics or using them in a display server like Wayland?

So I was saying that on Windows side, I think DirectX is pretty isolated for complex 3D graphics, and stuff like your display window manager, or the Windows GUI and all, don't just use the same API made for complex 3D graphics. There are APIs and libraries made for simpler 2D graphics and all. But we on Linux just use OpenGL and Vulkan for everything, and OpenGL is slow.

GL and VK are such a standard now that they just work. Chromium on Linux supports VA-API through OpenGL or Vulkan, and it actually just kind of works.

You got a lot of things wrong, Python is used on Windows as well, comparing it to .NET and similar MS BS makes no sense because the 2 are not very much related.
I was saying that most of Windows doesn't use Python as far as I understand. Your 3rd party programs might require it. But on Linux, a lot of programs are made to use Python, because I think they don't have other proprietary solutions that Microsoft has.
 
You didn't get my point. OpenGL and Vulkan have capabilities for rendering complex 3D graphics. Is it a good thing to use them for simple 2D graphics or using them in a display server like Wayland?
You can use Vulkan for 2D sure, however not for wayland directly, wayland is window compositor, while if you want to draw graphics you'll need to draw it on a window area, called a window context.

That window may be handled by wayland however for rendering purposes you care only about the window context.
GLFW is how you create a window that's independent of platform specific windowing systems:

So I was saying that on Windows side, I think DirectX is pretty isolated for complex 3D graphics, and stuff like your display window manager, or the Windows GUI and all, don't just use the same API made for complex 3D graphics. There are APIs and libraries made for simpler 2D graphics and all. But we on Linux just use OpenGL and Vulkan for everything, and OpenGL is slow.
No you have things wrong, graphics rendering is one thing, while GUI programming is another thing.
On Windows to make windows and buttons etc. you use old fashioned Win32 API's which is the most low level for Windows you can go, e.g. to write your custom GUI.
However for rendering there is DirectX which is not limited to 3D but also suitable for 2D, input etc. but not for UI in traditional manner like Win32.

Similar to Vulkan where you need window context, with DirectX you need a handle to a window on which to draw your scene.
The handle is just an internal number by which OS knows to which window to sends messages e.g. rendering graphics scene.

I was saying that most of Windows doesn't use Python as far as I understand. Your 3rd party programs might require it. But on Linux, a lot of programs are made to use Python, because I think they don't have other proprietary solutions that Microsoft has.
I suggest you to categorize several most popular languages.
By "category" I mean:
1. Statically typed vs Dynamically typed languages and knowing the difference.
2. Compiled vs scripting languages
3. Languages that compile to byte code
etc. etc.

Knowing how to categorize will help you to understand fundamentals.

You might want to share what you're trying to learn or achieve?

edit:

I was saying that most of Windows doesn't use Python as far as I understand. Your 3rd party programs might require it. But on Linux, a lot of programs are made to use Python, because I think they don't have other proprietary solutions that Microsoft has.
I see what you mean, yes Python is integral to Linux OS's, it comes preinstalled with distros because a lot of packages require it.

Python however isn't preinstalled on Windows and by default no software requires it, for obvious reason which is that MS doesn't use Python to develop components for their OS.

So in this sense Python is requirement for many Linux packages, but otherwise it's used for both worlds equally, mostly end user programs like calibre.

Hopefully I got your question.
 
Last edited:
You can use Vulkan for 2D sure, however not for wayland directly, wayland is window compositor, while if you want to draw graphics you'll need to draw it on a window area, called a window context.
Sway runs on wlroots, which uses OpenGL ES I think. So that means just to run my display, Sway has to use OpenGL for that, right? The same graphics API which is used for complex 3D graphics being used at the lowest level as something to run your display?

Now what I am confused in, is for Windows. I tried to look everywhere, and it seems like at the bare minimum, just to run your display, it too uses something like Direct3D? It isn't clear. AI says GDI and DXGI is also used. And people say besides the "3D" in the name, it is just used for normal GPU programming. So that is what resides at the lowest in the Windows Graphics Architecture?

But at least for user-space graphical programs, at the low end you can use stuff like Windows GDI, DirectWrite, even Direct2D, or stuff like that, but most of the time, you would be using higher level libraries such as Win2D, .NET, WinRT, etc, but idk if all that still converts into Direct3D. In Linux, you have GTK or QT, but it seems like those too convert to OpenGL in the backend?

So in Linux, that would be like using DirectX (it supports a lot more stuff such as input, audio, etc, but I am just talking about the rendering part) for rendering everything, whereas it is used for mostly game development.

So similar to that, either I have a suspicion that it is not efficient to use OpenGL or Vulkan for such low level or simple rendering, or that they are more like general tools for programming a GPU rather than specifically used for rendering complex graphics.

Yeah sorry if my question seems too confusing, but I made my best to explain it.
 
- I wanted to add on that I admire the Linux world all the low level stuff is written in pure C/C++. No .NET, XAML, Javascript, bs. Just pure C/C++. Good and optimized

Close, no C++, only C. But many drivers are now being written in rust.
 
most of the Linux world just uses OpenGL

True, but there are some other options.

DXVK this allows DirectX applications to run on Linux.
WebGL is a JavaScript API, that will render3D stuff in a browser.
Allegro is becoming more popular, at least for Linux gaming.

Finally, this Bevy game engine looks very promising. It's written in Rust, so it's very fast.




I believe Proton uses DXVK.
 
Close, no C++, only C. But many drivers are now being written in rust.
C++ is still dominating in game development, I believe that's what the OP is interested about.
Or perhaps graphical simulation programs, because this is where graphics API's he is referring to are used.
Vulkan, OpenGL and DirectX are C but are used by C++ in fact.

However I'm confused because he also brings in UI which can be made by these graphics API's but it can also be completely it's own thing without any graphics and without C or C++ altogether like QT.
 
OpenGL and DirectX are C but are used by C++ in fact.


It seems OpenGL is still just C.

For some interesting reads, google "Why doesn't Linus Torvalds like C++" sometime. :)
 
It seems OpenGL is still just C.
Yes it is, plain C, just like Vulkan, Win32 and other similar low level API, they're all C because this then work for both.
But programs or games written in C to my knowledge that use these API's are rare, you're more likely to see usage in C++, at least in Windows world, I'm sure this trend applies to Linux as well.

edit:
 
I may need a tetanus shot soon.




Side note here: I guess this was written in rust also, but now if you get a kernel panic,
Linux will print a QR code for you to scan. I've seen this happen once. (we had a failed
SATA controller). I actually think this is a good idea, having the stack trace on the broken
computer screen is fine, but kind of useless because you can't do anything with that information easily.
The QR code on your mobile phone works even if your computer is crashed.

 
Last edited:
What's your objective? general understanding or learning programming?
Why would I ask this to learn programming? Am I really not being that clear in my posts?

I was just asking that are GL and VK (mostly still GL sadly) good to use at such low level positions or for rendering 2D graphics?

In the Linux world, everything seems to run on OpenGL in the backend. Few have Vulkan now. I am not sure on the Windows side if Direct3D itself is what runs at the lowest level to run the display, or maybe its DXGI. Whatever it might be, the upper layers of Windows have different libraries suited for GUI, simple 2D graphics, or complex 3D graphics, etc. On Linux, we do have GTK, Cairo, or Wayland compositors, but they totally use OpenGL in the backend.

What I mean is, if you are developing a 2D game in a 3D game engine, you are just simulating 2D graphics in a 3D capable space. Just like that, if you are rendering 2D graphics in OpenGL, you are kind of doing the same.

I am not stating anything, I am asking. If this is the implementation, we don't need a special renderer to take place at the low level or to render simple 2D graphics, and OpenGL or Vulkan just work? I mean imagine if Microsoft used Vulkan to render your display. Would that be efficient?
 
I may need a tetanus shot soon.

I'm a retired duffer who wrote programs in a variety of languages. I no longer program anything and I was never that good at it. In fact, as soon as I could, I paid people good money to do that for me.

But, from what I've read, Rust is actually pretty good.

I suppose it's an appeal to authority and a potential fallacy, but it also seems likely that they folks behind the choice to move to Rust know what they're talking about and did so for good reasons. That could be entirely wrong, but it just seems likely.

If nothing else, I'm willing to trust their decisions and hope for the best!
 
What I mean is, if you are developing a 2D game in a 3D game engine, you are just simulating 2D graphics in a 3D capable space. Just like that, if you are rendering 2D graphics in OpenGL, you are kind of doing the same.
Yes but big IF you are developing 2D in 3D engine.

There are engines that are strictly 3D, you can suffer using them for 2D games or you can do yourself a favor use 2D engine instead, shoot yourself in foot or choose the right tool for your job, it's up to you.

e.g. Unreal engine is 3D engine, but can be used for 2D in a way you described, which is drawing 2D scene in 3D space, this is workaround however because the engine is not 2D engine and requires some extra work.

However using OpenGL or Vulkan for 2D is different story and will work fine for both, because these are not engines, you're mixing graphics API with game engine.

I am not stating anything, I am asking. If this is the implementation
Implementation of whether it's 2D or 3D engine or both depends on game engine, graphics API like Vulkan on another side however provides different API's to be used for both, e.g. by using them to write an actual engine.

I was just asking that are GL and VK (mostly still GL sadly) good to use at such low level positions or for rendering 2D graphics?
Yes, they are, but you won't use them for traditional GUI.

In the Linux world, everything seems to run on OpenGL in the backend. Few have Vulkan now. I am not sure on the Windows side if Direct3D itself is what runs at the lowest level to run the display, or maybe its DXGI. Whatever it might be, the upper layers of Windows have different libraries suited for GUI, simple 2D graphics, or complex 3D graphics, etc. On Linux, we do have GTK, Cairo, or Wayland compositors, but they totally use OpenGL in the backend.
You're again mixing traditional GUI with drawing a scene on an area of a window.
Traditional GUI tookits such as GTK, Win32 are totally different thing from OpenGL, DirectX or Vulkan, and no, graphics API's like Vulkan or DirectX are NOT backend to traditional UI frameworks.

You can however use them in traditional UI in the way I already explained in my previous post.
 

Members online


Top