Skip to content

Instantly share code, notes, and snippets.

@tobetchi

tobetchi/main.cpp

Created Sep 28, 2016
Embed
What would you like to do?
openFrameworks OSC send sample
#include "ofMain.h"
#include "ofApp.h"
int main( ){
ofSetupOpenGL(1024, 768, OF_WINDOW);
ofRunApp(new ofApp());
}
#include "ofApp.h"
void ofApp::setup() {
// OSC Setup
sender.setup(HOST, SEND_PORT);
}
void ofApp::mouseMoved(int x, int y) {
int layer = 1;
float opacity = ofMap(y, 0, ofGetHeight(), 1.0, 0);
m.setAddress("/layer"+ofToString(layer)+"/video/opacity/values");
m.addFloatArg(opacity);
sender.sendMessage(m);
m.clear();
}
#pragma once
#include "ofMain.h"
#include "ofxOsc.h"
#define SEND_PORT 7000
#define HOST "localhost"
class ofApp : public ofBaseApp {
public:
void setup();
void mouseMoved(int x, int y);
private:
ofxOscSender sender;
ofxOscMessage m;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment