Skip to content

Instantly share code, notes, and snippets.

@rettuce
Last active August 29, 2015 14:14
Show Gist options
  • Save rettuce/0f871f7b017f59550a5e to your computer and use it in GitHub Desktop.
Save rettuce/0f871f7b017f59550a5e to your computer and use it in GitHub Desktop.

Revisions

  1. rettuce renamed this gist Jan 29, 2015. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion gistfile1.cpp → oF SimpleSyphon.app
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    #include "ofMain.h"
    #include "ofxSyphon.h"

  2. rettuce created this gist Jan 29, 2015.
    54 changes: 54 additions & 0 deletions gistfile1.cpp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,54 @@

    #include "ofMain.h"
    #include "ofxSyphon.h"

    const unsigned int WIDTH = 1920;
    const unsigned int HEIGHT = 1080;

    class ofApp : public ofBaseApp
    {
    ofVideoGrabber video;
    ofxSyphonServer mainOutputSyphonServer;

    public:
    ofApp(){}

    void setup()
    {
    ofSetFrameRate(60);
    ofEnableSmoothing();
    ofBackground(0);

    video.initGrabber(WIDTH,HEIGHT,true);
    // mainOutputSyphonServer.setName("webcam");
    }

    void update()
    {
    video.update();
    mainOutputSyphonServer.publishTexture(&video.getTextureReference());
    }

    void draw()
    {
    video.draw(0, 0, WIDTH*0.1,HEIGHT*0.1);
    ofDrawBitmapString(ofToString(ofGetFrameRate()), WIDTH*0.1-60, 10);
    }

    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){};
    };

    #include "ofAppGLFWWindow.h"
    int main(int argc, const char** argv)
    {
    ofAppGLFWWindow window;
    ofSetupOpenGL(&window, WIDTH*0.1, HEIGHT*0.1, OF_WINDOW);
    ofRunApp(new ofApp);
    return 0;
    }