Created
November 13, 2015 10:24
-
-
Save urshofer/511c28d970085a6afd59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ofMain.h" | |
#include "ofApp.h" | |
//======================================================================== | |
int main( ){ | |
ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context | |
// this kicks off the running of my app | |
// can be OF_WINDOW or OF_FULLSCREEN | |
// pass in width and height too: | |
ofRunApp(new ofApp()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ofApp.h" | |
//-------------------------------------------------------------- | |
void ofApp::setup(){ | |
MO[0].setLoopState(OF_LOOP_NONE); | |
MO[1].setLoopState(OF_LOOP_NONE); | |
MOPointer = 0; | |
} | |
//-------------------------------------------------------------- | |
void ofApp::update(){ | |
static int lastMod = ofGetElapsedTimeMillis(); | |
static int action = 0; | |
static int moviecount = 1; | |
static string movieFile = ""; | |
if (ofGetElapsedTimeMillis() - lastMod > 500) { | |
if (action == 0) { | |
cout << "Append " << ofToString(moviecount) << ".mp4" << endl; | |
movieFile = ofToString(moviecount) + ".mp4"; | |
/* MO[MOPointer].close();*/ | |
MO[MOPointer].loadAsync(movieFile); | |
action++; | |
if (moviecount < 3) | |
moviecount ++; | |
else | |
moviecount = 1; | |
} | |
else if (action == 1) { | |
action = 0; | |
MO[MOPointer].play(); | |
MOPointer = MOPointer == 1 ? 0 : 1; | |
} | |
lastMod = ofGetElapsedTimeMillis(); | |
} | |
MO[0].update(); | |
MO[1].update(); | |
} | |
//-------------------------------------------------------------- | |
void ofApp::draw(){ | |
MO[0].draw(0,20 , 320, 240); | |
MO[1].draw(330,20 , 320, 240); | |
} | |
//-------------------------------------------------------------- | |
void ofApp::keyPressed(int key){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::keyReleased(int key){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::mouseMoved(int x, int y ){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::mouseDragged(int x, int y, int button){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::mousePressed(int x, int y, int button){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::mouseReleased(int x, int y, int button){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::mouseEntered(int x, int y){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::mouseExited(int x, int y){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::windowResized(int w, int h){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::gotMessage(ofMessage msg){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::dragEvent(ofDragInfo dragInfo){ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "ofMain.h" | |
class ofApp : public ofBaseApp{ | |
public: | |
ofVideoPlayer MO[2]; | |
int MOPointer; | |
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 mouseEntered(int x, int y); | |
void mouseExited(int x, int y); | |
void windowResized(int w, int h); | |
void dragEvent(ofDragInfo dragInfo); | |
void gotMessage(ofMessage msg); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment