Sunday 20 October 2013

Quick drawings

This method has been used elsewhere!!! EDIT: see Robert Hodgin http://roberthodgin.com/stippling/
I AM COPYING IT!
So don't be surprised when you find it elsewhere.
I have however, ported the method to C++, and optimised it so it doesnt use the square root function involved with calculating the distance between two points (a^2 = b^2 + c^2).
Soooo....
PYTHAGORAS THEOREM, BITCHES!

Win for not doing hard math.
First, a picture of someone else's eye (no opt):


Second (no opt):

Third, a picture of my cat (with sqrt opts):

Friday 11 October 2013

The ArrayCube

This project started as a quick sketch with Nick Noble, a COMP1720 student, to learn about arrays.

We created a cube object, gave it some values, a vector location and stuff. And whacked it into a 3d array, drew them all. And as soon as you know it we have some weird stuff like this:



And thats all great. But I liked this. I wasn't happy with all the crap that Processing was giving me.
"Only 8 lights" they said.
"You're drawing too many cubes" they said.
So I started porting it to openFrameworks:







Now look at me, creating classes in C++ for glory. 
Problem is that its even slower. 
WHATS THAT OPENFRAMEWORKS? YOU'RE EVEN SLOWER THAN PROCESSING?
So I did a few more iterations:



Made some changes:



But still, why is this crap running so slow?
C++ doesn't treat variables like Processing does. Assigning a value (using =) makes a copy of it. And I have a problem with that. I'm drawing many, many cubes. Like a lot of them. All of the cubes. And I want them to just grab some value from somewhere else to use as their opacity or brightness or whatever the hell I want to to be.

I needed to start using pointers.

I started using pointers. Things got faster.
I started using more pointers. Things got much faster.
I used pointers in a class, had them coming out my arse.
I set *my = &day and filled it with win.
I pointed at 0x4632b2b and fucking killed it.
And so now I'm like:
"HELL YEA! I CAN DO THE POINTER DANCE! EAT MY SHORTS, PROCESSING!"
But I was still not fully pleased. It was missing something. Some kind of other input and interaction with its surroundings that would make it whole. I looked high and low. I googled this and I googled that. 
And then it struck me.
"WE NEED SOME DSP ALL UP IN THIS BITCH!"
 And after learning very quickly how to use openFrameworks' ofSoundStream I finalised the code for having it not only play sound (End Theme by Zero 7), but react dynamically to sound input.
And this is the result: