OpenGL Project 1: Menger Sponge
Posted by TimothySep 18
I’m taking introduction to computer graphics this semester which focuses on OpenGL and our first project is due Monday. Conceptually speaking the project was supposed to be very easy as a similar project’s code was given to us, the Sierpinski Tetrahedron. The difference here is that the Menger Sponge removes central cubes from cubes.
I was agonizing over how I was going to do it for 3 days this week, then I had a breakthrough moment and spent the last 2 days working on it. This is the executable. There is a right click menu which shows allows different modes to be set as well as show you the keyboard shortcuts.
- W, A, S, D, Q, E rotate the cube
- F will swap between wireframe and solid cube mode
- L will change the lighting. Useful in wireframe mode
- V will display the inverse sponge.
- 0-4 changes the level of iteration. I could have gone to 5 but time to render 5 iterations is about 10 seconds on my computer and on 4 iterations the rotation is very sluggish.
- +/- Will scale the size of the cubes
If I really want to spend some extra time working on it, I’d like the change the lighting a bit and add mouse based rotation. The main function I used for drawing the cube doesn’t allow for texturing so I’d probably look into rewriting that entire function.
No source code in this zip, just the executable and the required DLL.
UPDATE: Corrected the inversion function and discovered that you need Visual Studio installed or the executable might not run. I’ll post source at the end of the semester.
One comment
Comment by artin on December 15, 2014 at 8:34 AM
i need cod menger sponge
plase sent for me