Skip to content

Instantly share code, notes, and snippets.

@koji
Created June 12, 2017 02:31
Show Gist options
  • Save koji/20ecc88afbb84ebc9ee11927a198558c to your computer and use it in GitHub Desktop.
Save koji/20ecc88afbb84ebc9ee11927a198558c to your computer and use it in GitHub Desktop.
openFrameworks_camera.cpp
//--------------------------------------------------------------
void ofApp::setup(){
ofSetFrameRate(60);
ofBackground(0);
// capture size
myVideo.initGrabber(640,480, true);
}
//--------------------------------------------------------------
void ofApp::update(){
myVideo.update();
}
//--------------------------------------------------------------
void ofApp::draw(){
int left = (ofGetWidth() - myVideo.getWidth())/2;
int top = (ofGetHeight() - myVideo.getHeight())/2;
ofTranslate(left, top);
myVideo.draw(0,0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment