Last semester I got my first experience with 3D programming – something I had wanted to learn how to do for quite a while. One of our first assignments was to get a handful of primitives moving around on screen (first screenshot). I was motivated enough to continue expanding the project, and added 9 smaller cubes that formed a larger cube, along with a large sky-box-looking cube.
Once I got to that point, I figured – why not take it further? I started thinking about how I could get the “Rubik’s cube” to rotate like the real thing.
After many hours of trying, and several note pad pages full of indices and diagrams …
… I still couldn’t get it to work.
I thought I’d take a break from the rotation code and fix the colours so that the inside faces were black.
But I could only prolong the inevitable long hall of getting stackable rotations working that was ahead of me – and long it was.
However eventually, after many hours – I got it! I decided to add a textured plane that cut through the cube which to show the controls for rotating the layers. Printing the controls out like this made clear just how ridiculous they were – the next step was to replace them with something more sane.
I only now got around to improving the input method – several months since I have last worked on the project. Now, instead of pressing one of a dozen keys to rotate a layer, you simply click on the layer you want to rotate; left for clockwise rotations, right for anti-clockwise.
Currently, you can also randomly scramble the cube by hitting a key, and reset it by hitting another key.
Like with any project there are things I’d like to fix and lots of things I’d like to add, but I have to call it at some point, and I think here is that point for this project. Especially with how many other projects I have going at the moment. Plus it feels great to have another one in the “finished” list.
Thanks for reading! I’ll be back soon with another post on my graphics API comparison project.