by gw · 6y ago · 0 comments
In a way I find OpenGL too complicated sometimes, some of its abstractions don't really make a whole lot of sense on modern hardware. Having a lower level API can make some code simpler to write, at least in theory. When I use OpenGL I often find myself thinking "I sure hope the driver will manage to understand what I'm trying to do and not end up doing something silly".
Note that my exposure to OpenGL comes mainly from console emulators though, and that's obviously very biased since emulators need to mimic very quirky behaviors of the original hardware, and that often results and very un-idiomatic GL code.
In 4.x they added DSA[1], which lets you avoid the global state a lot of the time. There's still some, but much less.
I do agree, though, that opengl is somewhat a mess, and vulkan really overwhelming.
These days I rarely ever bother with threaded OpenGL, and I stick to one context per thread, using OS surface sharing primitives (DXGI, IOSurface, etc.) to communicate.
These things are obviously related.
From my work in OO langs, I believe it is possible to wrap OO code in functional code to some degree without rewriting, assuming that global references can be intercepted and resolved to local ones somehow, and that the state reference that encompasses all the globals is an immutable data struct
glBeginState(&stateObj); glEnable(GL_BLEND); glDepthTest(GL_LEQUAL); glEndState(&stateObj);
and then later on you'd do glBindState(&stateObj) to apply it.
I have high hopes for WebGPU though and I am going to migrate my renderer to it soon.
I get it, Vulkan is low level, but still.
Khronos is now driving the Anari effort, because most visualization toolkits could not be bothered to move forward into Vulkan.
Pity that they decided to just bother with C99 though.
Isn't this the trend nowadays? I've seen recently that simple languages are trending again, languages like C, Go, Zig, Erlang, Lua. I think we hit the ceiling with mammoths like C++ and Scala.
That is, in fact, precisely the wrong advice.
Vulkan runs on Windows, Linux, and OS X (via MoltenVk). Nothing else does.
OS X runs OpenGL 3.Ancient and has now dropped OpenGL. OpenGL drivers for Linux tend to be laughably worse than the Vulkan drivers.
All of the major gaming companies have basically said "We have no OpenGL jobs. We have a ton of unfilled Vulkan jobs."
If you aren't using DirectWhatever, Vulkan is going to be the only useful 3D API very shortly.
Note that most of the newer OpenGL features are largely about sending stuff faster to the GPU, not enabling new GPU features - you can do a lot of stuff with OpenGL 4.1. IMO if you are struggling for CPU performance with OpenGL then you might be better moving to Vulkan. But if this isn't your bottleneck then there isn't a reason to not stick with OpenGL.
If OpenGL drivers on Linux are "laughably worse" (though in practice i haven't much of a difference) then the solution is to improve those drivers. It'll be better for all the thousands of existing applications too.
ICD OpenGL drivers are also not supported on Windows ARM variants.
Microsoft is driving the effort of OpenGL and related technology on top of DirectX instead.
https://devblogs.microsoft.com/directx/in-the-works-opencl-a...
Also so far there is no Vulkan on PlayStation, and while Switch does support Vulkan/OpenGL 4.5, most titles are either using middleware like Unity (ca 50% of Switch titles) or NVN.
Hell, even though Khronos tried to do exactly that with the core/compatibility schism, pretty much all existing implementations decided breaking people's code is a stupid move and mostly ignored it (Apple being an exception but Apple hates developers[0] and their OpenGL implementation was always awful - even then, Apple's implementation is still an implementation of a stable API).
In practice it means that your currently working code will remain working in the future and there are good chances that you'll be able to port it in other places with either official or unofficial implementations.
[0] OK, OK, i know, Apple doesn't "hate" developers, they just do not care about them at all and they'd happily break things like a hippo dancing in a glassware shop if they believe that would make their own developers feel better.
Vulkan lets dev do things directly.
You could say opengl is one "layer of crap" Carmack was talking about.
I'm still happy to use it though.
Use the bgfx.
If you use it, then you'll get no help from the platform on getting it to run. Random parts may begin to break, and the intention is likely an eventual removal.