diff options
| author | Tim Redfern <tim@eclectronics.org> | 2012-01-05 00:02:13 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2012-01-05 00:02:13 +0000 |
| commit | 7641fad8ebc4ba0e6412fcb7a556a705c0a6ea2c (patch) | |
| tree | 5eb40687deac0089d9c054cf62a0fcb3bc2ba50f /src/testApp.cpp | |
| parent | 16cc03c435982383627dd01341656d0371ca1f2b (diff) | |
viewport objectified
Diffstat (limited to 'src/testApp.cpp')
| -rw-r--r-- | src/testApp.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/testApp.cpp b/src/testApp.cpp index 42f7055..7e448fd 100644 --- a/src/testApp.cpp +++ b/src/testApp.cpp @@ -25,10 +25,12 @@ void testApp::setup(){ mode=CALIBRATE; - views=new viewpoint[1]; + views=new viewpoint[2]; //todo: read this from xml - views[0].setup(ofGetWidth(),ofGetHeight(),0,0); + numViews=2; + views[0].setup(ofGetWidth()/2,ofGetHeight(),0,0); + views[1].setup(ofGetWidth()/2,ofGetHeight(),ofGetWidth()/2,0); activeView=0; } @@ -39,9 +41,11 @@ void testApp::update(){ //-------------------------------------------------------------- void testApp::draw(){ - - views[0].setLight(); - views[0].begin(); + for (int i=0;i<numViews;i++) { + views[i].setLight(); + } + for (int i=0;i<numViews;i++) { + views[i].begin(); ofSetColor(255, 255, 255, 255); ofFill(); switch(mode) { @@ -62,24 +66,32 @@ void testApp::draw(){ glPopMatrix(); break; } - views[0].end(); + views[i].end(); + } ofSetHexColor(0xFFFFFF); ofDrawBitmapString("fps: "+ofToString(ofGetFrameRate(), 2), 10, 15); } //-------------------------------------------------------------- void testApp::keyPressed(int key){ + //todo: 'both' mode views[activeView].keyPressed(key); switch (key) { - case '1': + case '8': mode=CALIBRATE; break; - case '2': + case '9': mode=DISPLAY; break; - case '3': + case '0': mode=NOTHING; break; + case '1': + activeView=0; + break; + case '2': + activeView=1; + break; } } |
