diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cpp | 2 | ||||
| -rw-r--r-- | src/testApp.cpp | 30 | ||||
| -rw-r--r-- | src/testApp.h | 1 | ||||
| -rw-r--r-- | src/viewpoint.cpp | 10 |
4 files changed, 28 insertions, 15 deletions
diff --git a/src/main.cpp b/src/main.cpp index 1ed640d..ac9bc8c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,7 +21,7 @@ int main( ){ ofAppGlutWindow window; - ofSetupOpenGL(&window, 512,512, OF_WINDOW); // <-------- setup the GL context + ofSetupOpenGL(&window, 800,400, OF_WINDOW); // <-------- setup the GL context glutIgnoreKeyRepeat(1); glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF); //these don't work!!! printf("key repeat ignore: %i\n",glutDeviceGet(GLUT_DEVICE_IGNORE_KEY_REPEAT)); 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; } } diff --git a/src/testApp.h b/src/testApp.h index e2138a0..95aabf7 100644 --- a/src/testApp.h +++ b/src/testApp.h @@ -54,6 +54,7 @@ class testApp : public ofBaseApp{ viewpoint* views; int activeView; //receives keypresses + int numViews; int mode; diff --git a/src/viewpoint.cpp b/src/viewpoint.cpp index daca64f..225ad0f 100644 --- a/src/viewpoint.cpp +++ b/src/viewpoint.cpp @@ -2,7 +2,7 @@ #define DEBUG 0 void viewpoint::setup(float w, float h, float x, float y) { - window=ofRectangle(w,h,x,y); + window=ofRectangle(x,y,w,h); distortFactor=0.0; renderFBO.allocate(window.width,window.height,GL_RGB); @@ -21,7 +21,7 @@ void viewpoint::setup(float w, float h, float x, float y) { vars[4].set('u','n',0.0,10,1.0,3.0); vars[5].set('j','h',0.0,10,1.0,3.0); vars[6].set('o','l',1000.0,10,1.0,3.0); - vars[7].set('q','a',0,1,1.0,3.0); + vars[7].set('q','a',0,.000001,1.0,3.0); light.enable(); light.setDirectional(); @@ -55,9 +55,9 @@ void viewpoint::end(){ //ofSetColor(I_fade1,I_fade1,I_fade1); int gridX=50; int gridY=50; - int xStep=ofGetWidth()/2; - int yStep=ofGetHeight()/2; - ofTranslate(ofGetWidth()/2,ofGetHeight()/2); + int xStep=window.width/2; + int yStep=window.height/2; + ofTranslate(window.x+xStep,window.y+yStep); //todo: distort texcoords instead of vertex coords for (float i = -1; i < 1.001; i+=(2.0f/gridY)){ |
