Variables &
Open Frameworks
Open Frameworks
Last time, we explored a few examples. Today, first, I'd like you to see and hear about a few examples from somewhere who works with this library professionally, as well as some of the works that influence him.
Now, we'll continue playing with Open Frameworks on our own machines.
First, we'll talk a bit about variables, and then play with them a bit.
In case you don't remember, a variable is basically a place in memory where you can temporarily store data. Don't get his confused with storage, like the hard drive. Memory is the ram, and that data is only stored temporarely. This type of memory also requires electricity to hold the data, if it stops receiving power, the data is lost. This is also why restarting a computer is a sure-fire way to clear the ram.
We'll briefly reference a variable's scope next.
When we define a variable inside a function, let ofApp::update(), that is a local variable. It only exists inside of that function. When we leave that function, the program forgets how to access that. For a variable to exist outside of a function, the easiest thing to do is to make sure it is not initiated inside of a function. We call these global variables, and they can be accessed inside of functions too.
In addition to our own self-created variables, some variables already exist. A programming language or library may have an easy way to access some of these built into it. We'll look at a couple.
Now that you know some of the basics, make something interesting.
Use variables, conditionals, and loops to make lots of squares that change as the program runs.
Here's a bit of extra guidance.
Upload a video of your running program for today's task.