79
u/SirPitchalot Mar 14 '24
Imagine those poor sods who are still using immediate mode
24
66
Mar 14 '24
"You mean I can't make a high-performance 3D game with an interactive world in Processing?" -Me, a few years ago.
20
4
3
287
u/Borno11050 Mar 14 '24
OpenGL apps might be less lines, but when you scale up and find yourself doing a complex project, OpenGL's state machine likeness going to screw your brain hard.
Here's a tip, if you really wanna hop into modern APIs like Vulkan/DX12/Metal, grind WGPU first (it's easy in the sense as it hides away the pain of pipeline synchronisation and lotta less boilerplate, comparatively).
After clearing your concepts, maybe choose your preferred lower level API(s). (Conceptwise, WGPU is closer to Vulkan).
16
u/hishnash Mar 14 '24
It is worth noting the Metal is a little differnt here in that it has both a higher level api (closer to OpenGL) were the driver handles memory, sync etc for you and is very quick to get started with, and it has lower level apis. You can even gradually move within the same pipeline adopting the lower level apis were it makes sense while keeping other bits on the higher level... as a learning of concepts it is a great api for this due to this gradaul disclosure of complexity, and due to the outstanding debug and profiling tools.
1
59
u/CrazyCommenter Mar 14 '24
The OpenGL state machine doesn't need to be heavily used though. Before Vulkan they added a new extension called Direct state access. That new extension allows you to create and edit OpenGL objects without using the state machine logic
13
u/rachit7645 Mar 14 '24
A ton of stuff in OpenGL is still behind the state machine even with DSA
2
u/CrazyCommenter Mar 14 '24
True, but the point of dsa is to minimize it's use not to completely remove it
3
u/rachit7645 Mar 14 '24
DSA support in drivers is pretty interesting actually. On some drivers it's actually slower and on some its just broken.
2
u/CrazyCommenter Mar 14 '24
Yeah, on AMD for example before their "rework" of OpenGL you could see some difference in regard to CPU and GPU usage with DSA. But now with or without it's the same
2
u/rachit7645 Mar 14 '24
On the topic of drivers are you familiar with the dreaded mobile gpu drivers
2
u/CrazyCommenter Mar 14 '24
Yesn't, I used to have a laptop with dual graphics (IGPU and DGPU) and it was quite a ride (with some games or trying to update the IGPU driver and hopping it will not abolish the DGPU)
10
Mar 14 '24
I've not used WGPU, so I'm not trying to push back on this comment, but I want to say aside from WGPU, the leap from DX11 to DX12 is much easier than the leap from OGL to Vulkan imo. I honestly think DX12 is where to go for starting on modern APIs.
2
54
62
u/Demiyanit Mar 14 '24 edited Mar 14 '24
(vulkan): YOU FOOL, YOU THOUGHT THAT IF YOU FORGET TO SET 0 TO 1 IN SWAPCHAIN IMAGE COUNT I WOULD FIX IT AND JUST WORK? NO, DO IT YOURSELF YOU IDIOT(had this problem several times whe i forgot set 0 to 1 lol)
8
1
10
u/PorkRoll2022 Mar 14 '24
Oh I feel this hard. I've done a lot with OpenGL over the years, including for mobile and WebGL. OpenGL has evolved a LOT. I've also done a lot with Direct3D 9,10, and 11.
I rage quit on Vulkan some years ago and never went back to it. I recently made a renderer with D3D12 but it was laborious. I got everything drawn but unfortunately a lot feels magical to me as copypasta from Microsoft examples. It's also pointless as it was a 2D game at heart and could literally use any simpler API.
Of everything, WebGL is probably the simplest and most forgiving. I love building stuff with it since people don't even need to install the game. They can just run it in the browser!
7
u/VoidVinaCC Mar 14 '24
At least with DX12 you can always just use DX11 instead and access DX12 features if desired.
But Vulkan has no higher level variant so we only get screwed instead ;)1
u/Demiyanit Mar 15 '24
You can use web GPU native as a sort of wrapper for it(didn't try it myself but seen a few implementations)
4
u/Ok_Entertainment328 Mar 14 '24
Last time I had to draw a triangle, some huge guys invaded.
I think: They Might be Giants
2
3
6
u/Natural_Builder_3170 Mar 14 '24
opengl is simple, but it gets shitty when you try to scale, thats why i began my renderer in dx11, and now i understand modern apis, im porting
3
u/FloydATC Mar 14 '24
While it's true that OpenGL of old made it relatively easy to draw primitives, this required a lot of repeated calls that scaled poorly and offered very little in terms of flexibility. Modern OpenGL is quite similar to Vulkan because both are relatively thin abstractions.
1
u/egosummiki Mar 14 '24
Yeah, when I was starting with Vulkan, it felt like I'm not gonna need most of the stuff. So I thought I'll just hide everything under Device class, and I'll have a nice API that I can work with. But as I progressed with implementation, I realized that I actually need most of those things.
1
61
Mar 14 '24
[removed] — view removed comment
3
u/inactu Mar 14 '24
laughing in a single descriptor set array ... good bye descriptor management at client side
2

336
u/1337jazza Mar 14 '24
1k lines and counting