Skip to content

Instantly share code, notes, and snippets.

@jvcleave
Created December 5, 2012 08:00
Show Gist options
  • Save jvcleave/4213640 to your computer and use it in GitHub Desktop.
Save jvcleave/4213640 to your computer and use it in GitHub Desktop.
ofVideoGrabberRPI
#include "testApp.h"
bool hasStarted = false;
//--------------------------------------------------------------
void testApp::setup(){
ofSetLogLevel(OF_LOG_VERBOSE);
camWidth = 320; // try to grab at this size.
camHeight = 240;
}
//--------------------------------------------------------------
void testApp::update(){
ofBackground(100,100,100);
int delay = 2000;
unsigned long long currentTime = ofGetElapsedTimeMillis();
if (currentTime > delay)
{
if (!hasStarted)
{
hasStarted = true;
vidGrabber.setVerbose(true);
vidGrabber.setDesiredFrameRate(60);
vidGrabber.initGrabber(camWidth,camHeight);
}else {
vidGrabber.update();
}
}else
{
ofLogVerbose() << "waiting " << delay - currentTime << "ms";
}
}
//--------------------------------------------------------------
void testApp::draw(){
if (!hasStarted) {
return;
}
vidGrabber.draw(20, 20, camWidth, camHeight);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment