Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

How to place video in a moving primitive

$
0
0

@mehrbano_khattak wrote:

include "ofApp.h"

//--------------------------------------------------------------
void ofApp::setup() {
ofSetBackgroundColor(0);
ofSetFrameRate(60);
//time = 0;
vidGrabber.setDeviceID(0);
vidGrabber.setDesiredFrameRate(60);
vidGrabber.initGrabber(500,500);
}
//--------------------------------------------------------------
void ofApp::update() {
locX++;
locY++;
vidGrabber.update();
}
//--------------------------------------------------------------
void ofApp::draw() {
for (int x = 0; x < 10; x++) {
line (locX + x * ofGetWidth());
locX = locX % ofGetWidth();
}
}
void ofApp::line(float x) {
ofPushMatrix();
ofTranslate(x, ofGetHeight() / 2);
ofSetColor(255);
ofSetLineWidth(20);
//it should come here somewhere ... but how
float len = sin (ofMap (x, 0, ofGetWidth(), 0, PI)) * 20;
ofDrawLine(0, -len, 0, len);
ofPopMatrix();
}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles