46
u/Vast-Statement9572 Sep 19 '24
Congratulations. Getting anything to show up is about half the battle.
12
u/Flux247A Sep 19 '24
Thanks! Feels like I learned so much that I need a couple of days to let it settle lol!
5
u/BobbyThrowaway6969 Sep 20 '24
I saw you use ms afterburner for the text, was gonna say... I thought you did the text yourself haha, which is kinda painful to do from scratch
12
u/Excellent_Whole_1445 Sep 19 '24
Good job! It's such a good feeling to get SOMETHING on the screen! And with Vulkan that's no joke!
5
5
u/buyinggf1000gp Sep 19 '24
Reminds me of a triangle like this that I programmed but with software rendering, nice
2
u/Flux247A Sep 19 '24
Any resources you would recommend for software rendering?
3
u/buyinggf1000gp Sep 19 '24
For this specific thing I just studied about barycentric coordinates on triangles, you can use them to check if a point is inside a triangle, to fill triangles and to interpolate colors inside the triangle knowing the colors of the vertices, I didn't really care about efficiency or FPS, I just enjoy knowing how stuff works lol
I used C++ and SDL2, no hardware acceleration, just CPU altering memory pixel by pixel
https://en.m.wikipedia.org/wiki/Barycentric_coordinate_system
2
u/Flux247A Sep 19 '24
Ahh, I see.
I remember using SDL_BlitSurface for making a silly game. Did you use that?
2
u/raouffndt Sep 21 '24
can you tell us which textbook,tutorial you follow , I wanna try vulkan too I tried OpenGL 3 and I think vulkan is more interesting
2
u/Flux247A Sep 22 '24
I have the same story!
I found OpenGL a little too weird for my states with it's internal state machine. So I did it for a week and then left it.
For Vulkan, I followed parts of the vulkan-tutorial.com, vkguide.dev (older one), and the brendan galea's vulkan playlist.
As I jumped directly into vulkan with no graphice programming experience, each tutorial felt incomplete to me, so I followed multiple to get acquainted 😄
2
u/raouffndt Sep 22 '24
nice , ty for resouces, you suprised me with 400line i thought its way more to draw simple triangle,there's trend about simple triangle like urs you have to write about 1000lines
check this link:
https://github.com/SaschaWillems/Vulkan/blob/master/examples/triangle/triangle.cpp2
u/Flux247A Sep 22 '24
If you add the device selection, swapchain creation and shader compilation stuff, it definitely is.
But for learning purposes focusing on the render loop is more important than mundane tasks.
33
6
4
4
2
2
2
0
45
u/Flux247A Sep 18 '24 edited Sep 18 '24
Finally got the triangle showing in around 450 lines of code (Used vk-bootstrap because I was tired of rewriting the logic for the nth time).
Didn't understand everything at first so rewrote the same thing a couple of times to make it stick.
Only issue I face now is with the colors looking off due to SRGB or something (fixed now, it had something to do with difference between SRGB and UNORM).