From ed2d4581aa354d6c4040b061349fbe38f8af5e45 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Sun, 5 Feb 2012 23:13:12 +0000 Subject: restore settings correctly --- src/main.cpp | 4 ++-- src/testApp.cpp | 11 ++++++----- src/viewpoint.cpp | 16 ++++++++++------ src/viewpoint.h | 2 ++ 4 files changed, 20 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 15650ab..d8de5c8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,8 +17,8 @@ int main( ){ ofAppGlutWindow window; - //ofSetupOpenGL(&window, 1024,768, OF_FULLSCREEN); // <-------- setup the GL context - ofSetupOpenGL(&window, 1024,300, OF_WINDOW); + ofSetupOpenGL(&window, 1440,900, OF_FULLSCREEN); // <-------- setup the GL context + //ofSetupOpenGL(&window, 1024,300, OF_WINDOW); 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 4aaa009..c2772aa 100644 --- a/src/testApp.cpp +++ b/src/testApp.cpp @@ -17,18 +17,19 @@ void testApp::setup(){ glEnable (GL_COLOR_MATERIAL); //load the bottle model - the 3ds and the texture file need to be in the same folder - bottle.loadModel("bottle.3DS", 1); + bottle.loadModel("tigerbottle.3DS", 1); bottle.setRotation(0, 180, 1, 0, 0); - bottle.setPosition(0, 112, 0); + bottle.setPosition(0, 101, 0); //ofDisableArbTex(); - mode=CALIBRATE; + mode=DISPLAY; loadSettings("settings.xml"); whichClip=0; texture.loadMovie(clips[whichClip]); + texture.setLoopState(OF_LOOP_NORMAL); texture.play(); light=true; @@ -109,14 +110,14 @@ void testApp::keyPressed(int key){ case '<': whichClip--; if (whichClip<0) whichClip+=numClips; - texture.close(); + texture.stop(); texture.loadMovie(clips[whichClip]); texture.play(); break; case '.': case '>': whichClip=(whichClip+1)%numClips; - texture.close(); + texture.stop(); texture.loadMovie(clips[whichClip]); texture.play(); break; diff --git a/src/viewpoint.cpp b/src/viewpoint.cpp index 6a12c99..287cf26 100644 --- a/src/viewpoint.cpp +++ b/src/viewpoint.cpp @@ -3,8 +3,12 @@ void viewpoint::setup(map&settings){ //setup(float w, float h, float x, float y) { - if (DEBUG) printf("window: %f,%f %fx%f n",ofGetWidth()*ofToFloat(settings["x"]),ofGetHeight()*ofToFloat(settings["y"]),ofGetWidth()*ofToFloat(settings["w"]),ofGetHeight()*ofToFloat(settings["h"])); - window=ofRectangle(ofGetWidth()*ofToFloat(settings["x"]),ofGetHeight()*ofToFloat(settings["y"]),ofGetWidth()*ofToFloat(settings["w"]),ofGetHeight()*ofToFloat(settings["h"])); + x=ofToFloat(settings["x"]); + y=ofToFloat(settings["y"]); + w=ofToFloat(settings["w"]); + h=ofToFloat(settings["h"]); + if (DEBUG) printf("window: %f,%f %fx%f n",ofGetWidth()*x,ofGetHeight()*y,ofGetWidth()*w,ofGetHeight()*h); + window=ofRectangle(ofGetWidth()*x,ofGetHeight()*y,ofGetWidth()*w,ofGetHeight()*h); distortFactor=ofToFloat(settings["distort"]); renderFBO.allocate(window.width,window.height,GL_RGB); @@ -30,10 +34,10 @@ void viewpoint::setup(map&settings){ light.setDirectional(); } double viewpoint::getSetting(const string& setting){ - if (setting=="x") return window.x/ofGetWidth(); - if (setting=="y") return window.y/ofGetHeight(); - if (setting=="w") return window.width/ofGetWidth(); - if (setting=="h") return window.height/ofGetHeight(); + if (setting=="x") return x; + if (setting=="y") return y; + if (setting=="w") return w; + if (setting=="h") return h; if (setting=="fov") return vars[0].getVal(); if (setting=="targX") return vars[1].getVal(); if (setting=="targY") return vars[2].getVal(); diff --git a/src/viewpoint.h b/src/viewpoint.h index b5923bd..5ee9b63 100644 --- a/src/viewpoint.h +++ b/src/viewpoint.h @@ -49,4 +49,6 @@ class viewpoint { ofLight light; + float x,y,w,h; + }; -- cgit v1.2.3