HomeProjectsContactAbout MeBlog

Mienger Sponge

My first opengl project. A mienger sponge!

Made in 2025

About

This was a small demo project, that I used to learn a bit of opengl. I got alot of help from chatGPT for it, as I have not used opengl before. I also used glm for the vector math. OpenGL only renders triangles, so I had to define the triangles for a cube. Then each cube was an instance of those series of verticies. Then, I used the recursive algorithm to generate the mienger sponge. The key idea is to divide each face of the cube into 9 smaller squares and remove the center square, and then repeat the process for each of the remaining squares. However, the squares are not actually created until very last level of recursion. The performance is actually good, but it runs at 100% of GPU resources. I still have not looked into why. I also implemented basic fog and lighting.

Project Image

blogimg.png

Controls

  • WASD - Move around
  • Arrow Keys - Turn in 3d

Download

Download the source code. You will have to run it yourself and configure the makefile.

Download Windows Exe File