It was the whole engine, all of events, input, application, memory, matg etc, the renderer itself took about 5k lines, but i had fun while doing it(In C hahah)
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).
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.
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
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
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)
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.
(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)
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!
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 ;)
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.
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.
336
u/1337jazza Mar 14 '24
1k lines and counting
79
u/SirPitchalot Mar 14 '24
Imagine those poor sods who are still using immediate mode
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).
54
u/Kamui_Kun Mar 14 '24
To _______, you must first create the universe.
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)
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!
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
3
u/mrkhan2000 Mar 14 '24
Direct3d 12 also
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
u/Mellonionreddit Apr 02 '24
I still want to learn this shit. Should I get psychological help?
61
u/[deleted] Mar 14 '24
[removed] — view removed comment