Skip to content

Instantly share code, notes, and snippets.

@prisonerjohn
prisonerjohn / ofApp.cpp
Created November 21, 2019 05:02
OF Metaballs
#include "ofApp.h"
#include <glm/gtx/fast_square_root.hpp>
void ofApp::setup()
{
for (int i = 0; i < 10; i++)
{
blobs.push_back(Blob(ofRandomWidth(), ofRandomHeight()));
}
@prisonerjohn
prisonerjohn / main.cpp
Created November 18, 2019 05:48
Sensing Machines Blob Clipping
#include "ofMain.h"
#include "ofApp.h"
int main()
{
ofGLFWWindowSettings settings;
settings.setSize(1280, 720);
settings.setPosition(ofVec2f(100, 100));
settings.resizable = true;
@prisonerjohn
prisonerjohn / ezBall.cpp
Last active November 18, 2019 04:42
Sensing Machines Homography
#include "ezBall.h"
#include "ofApp.h"
void ezBall::setup(int x, int y)
{
pos = glm::vec2(x, y);
mass = ofRandom(10, 30);
color = ofColor(ofRandom(127, 255), ofRandom(127, 255), ofRandom(127, 255));
}
@prisonerjohn
prisonerjohn / ezBall-basic.cpp
Last active November 10, 2019 18:19
Sensing Machines Classes
#include "ezBall.h"
void ezBall::setup(int x, int y)
{
pos = glm::vec2(x, y);
mass = ofRandom(10, 30);
color = ofColor(ofRandom(127, 255), ofRandom(127, 255), ofRandom(127, 255));
}
void ezBall::draw()
@prisonerjohn
prisonerjohn / main-android.cpp
Last active November 10, 2019 19:48
Sensing Machines Mobile
#include "ofMain.h"
#include "ofApp.h"
int main()
{
ofSetupOpenGL(1024, 768, OF_WINDOW);
ofRunApp(new ofApp());
return 0;
}
@prisonerjohn
prisonerjohn / main-multi.cpp
Last active January 30, 2021 19:44
Sensing Machines FBOs
#include "ofApp.h"
int main()
{
ofGLFWWindowSettings settings;
settings.setSize(1280, 720);
settings.setPosition(glm::vec2(0, 0));
settings.resizable = true;
settings.decorated = true;
@prisonerjohn
prisonerjohn / ofApp-outMidi.cpp
Last active October 27, 2019 21:52
Sensing Machines Sound Out
#include "ofApp.h"
void ofApp::setup()
{
ofBackground(0);
// Setup sound output.
ofSoundStreamSettings settings;
settings.setOutListener(this);
//settings.sampleRate = 44100;
@prisonerjohn
prisonerjohn / ofApp-inFft.cpp
Last active October 27, 2019 21:49
Sensing Machines Sound In
#include "ofApp.h"
void ofApp::setup()
{
ofBackground(0);
// Print audio device list to the console.
soundStream.printDeviceList();
// Setup sound stream.
@prisonerjohn
prisonerjohn / ofApp-aspectFill.cpp
Last active October 24, 2019 19:11
Sensing Machines Draw Bounds
#include "ofApp.h"
void ofApp::setup()
{
grabber.setup(640, 480);
}
void ofApp::update()
{
grabber.update();
@prisonerjohn
prisonerjohn / ofApp-filter.cpp
Last active October 21, 2019 04:52
Sensing Machines NDI
#include "ofApp.h"
void ofApp::setup()
{
ofBackground(0);
ofSetFrameRate(60);
ofSetWindowShape(640, 480);
// Start a router to kick things off
// (otherwise the receivers don't work...)