Created
September 28, 2016 08:20
-
-
Save tobetchi/c1fa5493521d97db919d0e84469f35bc to your computer and use it in GitHub Desktop.
openFrameworks OSC send sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ofMain.h" | |
#include "ofApp.h" | |
int main( ){ | |
ofSetupOpenGL(1024, 768, OF_WINDOW); | |
ofRunApp(new ofApp()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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