r/GraphicsProgramming • u/Brick-Sigma • Feb 22 '26
Video My first OpenGL program after a month of reading: Sierpinski Triangle!
Hello there! It's been a little over a month now since I got the Learn OpenGL book written by Joey de Vries, and today I finally finished the first section of getting started with OpenGL.
With that, I present a little program that renders Sierpinski triangle in 3D in OpenGL. This is mostly inspired by the comments under the website's chapter for transformations, where a lot of people implemented the same triangle but in 2D. I decided to take it a little further with a 3D version in SDL3 and C, supporting a camera and my Xbox game controller, which was quite fun to program and mess around with.
Here's a link to my source code as well: https://github.com/BrickSigma/Sierpinski-Triangle-OpenGL.
Thanks for reading and have a great day ahead!
12
5
1
u/Dapper-Impression532 Feb 22 '26
It looks cool, How did you get your program to read input from the controller?
3
u/Brick-Sigma Feb 22 '26
I'm using SDL's Gamepad API, which makes it really easy to interface and poll events from game controllers.
2
3
u/Daneel_Trevize Feb 22 '26
Did you consider using SDL_GPU instead/next, to pick up the style of more modern rendering APIs, rather than OpenGL?