OpenFrameworks Demo

Nikolaus Gradwohl2008-07-20T20:02:00+02:00

this weekend i have written a little c++ program with openframeworks. This is a framework for writing creative programs. it is heavily inspired by processing.

While still in the prerelease state it has some very interesting features and it is realy fun to code with. To get to the download page one has to register for the mailinglist.

To get started copy the emptyExample folder from the apps/examples folder. in the src folder is a empty testApp.cpp and a testApp.h.

the program i have written draws little yellow squares on the screen, that get scared when they hear a sudden loud noise.

my testApp.h looks like this

#ifndef _TEST_APP
#define _TEST_APP


#include "ofMain.h"
#include "ofAddons.h"

class testApp : public ofSimpleApp{

    public:

        void setup();
        void update();
        void draw();

        void keyPressed(int key);
        void keyReleased(int key);
        void mouseMoved(int x, int y );
        void mouseDragged(int x, int y, int button);
        void mousePressed(int x, int y, int button);
        void mouseReleased();
        void audioReceived( float *input, int bufferSize, int nChannels );

        int boom;
};

#endif

my testApp.cpp looks like this

#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
    boom = 0;
    ofSetVerticalSync( true );
    ofSetFrameRate( 25 );
    ofSoundStreamSetup(0,1,this);
}   

//--------------------------------------------------------------
void testApp::update(){
}
//--------------------------------------------------------------
void testApp::draw(){
    ofBackground( 0,0,0 );
    int sx = 0;
    int sy = 0;
    if (boom>0) {
        ofSetColor(255,0,0);
        boom = boom -2;
    } else {
        ofSetColor(255,255,0);
    }
    ofFill();
    for ( int x=0; x < 11; x++ ) {
        for ( int y = 0; y < 7; y++ ) {
            if ( boom > 0 ) {
                sx = 10 * ofRandomf();
                sy = 10 * ofRandomf();
            }
            ofRect(sx + x*120 + 20, sy + y*120 + 20, 100, 100);
        }
    }
}

//--------------------------------------------------------------
void testApp::keyPressed  (int key){ 
}

//--------------------------------------------------------------
void testApp::keyReleased  (int key){ 
}

//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y ){
}

//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){
}

//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
}

//--------------------------------------------------------------
void testApp::mouseReleased(){
}

void testApp::audioReceived (float * input, int bufferSize, int nChannels) {
    int count = 0;
    for( int i=0; i<bufferSize; i++ ) {
        if (input[i] > 0.3 || input[i] < -0.3 ) {
            count++;
        } 
    }
    if ( count > 10 ) {
        boom = 25;
    }
}
read more ...

evil mango of death

Nikolaus Gradwohl2008-07-18T10:41:00+02:00

Today i saw a can of "mango pulp" in the kitchen of our office. i have no idea what "mango pulp" is - but im not sure i would like to eat something that looks at me like this >:-]

mango of death

read more ...

Wobbly Dragon Egg

Nikolaus Gradwohl2008-07-14T20:46:00+02:00

I have written a processing sketch again. This time it took me 15 minutes, and it visualizes a wobbly dragon egg

read more ...

Erlang OSC Dispatcher

Nikolaus Gradwohl2008-07-14T07:10:00+02:00

I have started a Project to write and osc message dispatcher in erlang. I want to use it to dispatch the data from my icontrol chuck script to other soundgenerating scripts or visualisation programms.

read more ...

Chuck iControl Projectpage

Nikolaus Gradwohl2008-07-14T06:46:00+02:00

as written before, i have started writing a chuck script that mapps the midi-data from my iControl to OSC events. I now have set up a proper project page for the script.

read more ...

Ruby Caldav Library

Nikolaus Gradwohl2008-07-14T06:27:00+02:00

I have a DAViCal running and i wanted to write a simple jabber bot that reminds me when i have forgotten to enter my timesheet data. So i have hacked together a simple ruby library to access the caldav protocol. More info and sourcecode is available on the project page

read more ...

Mousetrail

Nikolaus Gradwohl2008-07-13T22:06:00+02:00

I just made another completly useless Mousetrail Demo in 5 minutes using processing

Why this time? - same reason as last time :-)

read more ...

'Hello World' in 80 hacks / In 80 Sprachen 'Hallo Welt' - Phase 1

Nikolaus Gradwohl2008-07-13T20:40:00+02:00

I have started a multilanguage programing project. The goal is to create a "Hello World"-program using 80 programing languages. A list of programing languages i intend to use is already available on the project-page

read more ...

Nagios Glitzerlampe

Nikolaus Gradwohl2008-07-13T16:58:00+02:00

I made a new project page for my nagios visualisation system written in ruby.

read more ...

Bouncingball

Nikolaus Gradwohl2008-07-12T21:19:00+02:00

I hacked together a BouncinBall-Demo in 5 minutes using processing.

Why? Just because i can :-)

read more ...