環境は、OF 0.8.4、XCode 6.1.1
・ofxSyphonをgit clone.
・pgでサンプルスケルトン作成。
ofxSyphonをaddonで追加
・プロジェクトを開いて、下記設定する
・テストコード (ofApp.h)
#include "ofMain.h" #include "ofxSyphon.h" class ofApp : public ofBaseApp{ 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(int x, int y, int button); void windowResized(int w, int h); void dragEvent(ofDragInfo dragInfo); void gotMessage(ofMessage msg); ofSoundPlayer mySound; float radius; ofxSyphonServer mainOutputSyphonServer; ofxSyphonServer individualTextureSyphonServer; ofxSyphonClient mClient; };
ofApp.m
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup(){ ofBackground(0, 0, 0); ofSetVerticalSync(true); ofSetCircleResolution(64); ofEnableAlphaBlending(); ofSetFrameRate(60); ofSetBackgroundAuto(false); // ofSetFullscreen(true); //SYPHON mainOutputSyphonServer.setName("Screen Outputh"); mClient.setup(); mClient.setApplicationName("Simple Serverh"); mClient.setServerName(""); } //-------------------------------------------------------------- void ofApp::update(){ } //-------------------------------------------------------------- void ofApp::draw(){ ofSetColor(0, 0, 0, 5); ofRect(0, 0, ofGetWindowWidth(), ofGetWindowHeight()); int radius = ofRandom(10, 50); int r = ofRandom(100, 255); int g = ofRandom(255, 255); int b = ofRandom(255, 255); ofSetColor(r, g, b); int x = ofRandom(0, ofGetWindowWidth()); int y = ofRandom(0, ofGetWindowHeight()); ofCircle(x, y, radius); //SYPHON mClient.draw(50, 50); mainOutputSyphonServer.publishScreen(); }
mad mapperで連携できます。