{"id":1889,"date":"2010-09-18T02:37:55","date_gmt":"2010-09-18T07:37:55","guid":{"rendered":"http:\/\/www.timothyhanson.com\/?p=1889"},"modified":"2010-09-18T16:19:35","modified_gmt":"2010-09-18T21:19:35","slug":"opengl-project-1-menger-sponge","status":"publish","type":"post","link":"https:\/\/www.timothyhanson.com\/?p=1889","title":{"rendered":"OpenGL Project 1: Menger Sponge"},"content":{"rendered":"<p>I&#8217;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&#8217;s code was given to us, the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Sierpinski_triangle\">Sierpinski Tetrahedron<\/a>. The difference here is that the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Menger_sponge\">Menger Spong<\/a>e removes central cubes from cubes.<\/p>\n<p>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.<\/p>\n<ul>\n<li>W, A, S, D, Q, E rotate the cube<\/li>\n<li>F will swap between wireframe and solid cube mode<\/li>\n<li>L will change the lighting. Useful in wireframe mode<\/li>\n<li>V will display the inverse sponge.<\/li>\n<li>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.<\/li>\n<li>+\/- Will scale the size of the cubes<\/li>\n<\/ul>\n<p>If I really want to spend some extra time working on it, I&#8217;d like the change the lighting a bit and add mouse based rotation. The main function I used for drawing the cube doesn&#8217;t allow for texturing so I&#8217;d probably look into rewriting that entire function.<\/p>\n<p>No source code in this zip, just the executable and the required DLL.<\/p>\n<p><a href=\"https:\/\/www.timothyhanson.com\/projects\/glProj1.zip\">Download<\/a><\/p>\n<p>UPDATE: Corrected the inversion function and discovered that you need Visual Studio installed or the executable might not run. I&#8217;ll post source at the end of the semester.<\/p>\n<div style=\"width: 376px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" title=\"1 Iteration\" src=\"https:\/\/www.timothyhanson.com\/pics\/sponge1.jpg\" alt=\"1 Iteration\" width=\"366\" height=\"397\" \/><p class=\"wp-caption-text\">1 Iteration<\/p><\/div>\n<div style=\"width: 376px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" title=\"3 Iteration\" src=\"https:\/\/www.timothyhanson.com\/pics\/sponge3.jpg\" alt=\"3 Iterations\" width=\"366\" height=\"397\" \/><p class=\"wp-caption-text\">3 Iterations<\/p><\/div>\n<div style=\"width: 376px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" title=\"Inverse 1 Iteration\" src=\"https:\/\/www.timothyhanson.com\/pics\/sponge4.jpg\" alt=\"Inverse 1 Iteration\" width=\"366\" height=\"397\" \/><p class=\"wp-caption-text\">Inverse 1 Iteration<\/p><\/div>\n<div style=\"width: 376px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" title=\"Inverse 2 Iterations\" src=\"https:\/\/www.timothyhanson.com\/pics\/sponge5.jpg\" alt=\"Inverse 2 Iterations\" width=\"366\" height=\"397\" \/><p class=\"wp-caption-text\">Inverse 2 Iterations<\/p><\/div>\n<div style=\"width: 376px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" title=\"Inverse 3 Iterations\" src=\"https:\/\/www.timothyhanson.com\/pics\/sponge6.jpg\" alt=\"Inverse 3 Iterations\" width=\"366\" height=\"397\" \/><p class=\"wp-caption-text\">Inverse 3 Iterations<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;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&#8217;s code was given to us, the Sierpinski Tetrahedron. The difference here is that the Menger Sponge removes central cubes from cubes. I [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"class_list":["post-1889","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.timothyhanson.com\/index.php?rest_route=\/wp\/v2\/posts\/1889","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.timothyhanson.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.timothyhanson.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.timothyhanson.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.timothyhanson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1889"}],"version-history":[{"count":8,"href":"https:\/\/www.timothyhanson.com\/index.php?rest_route=\/wp\/v2\/posts\/1889\/revisions"}],"predecessor-version":[{"id":1895,"href":"https:\/\/www.timothyhanson.com\/index.php?rest_route=\/wp\/v2\/posts\/1889\/revisions\/1895"}],"wp:attachment":[{"href":"https:\/\/www.timothyhanson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1889"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.timothyhanson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1889"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.timothyhanson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1889"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}