diff options
| author | Tim Redfern <tim@eclectronics.org> | 2011-12-26 17:02:09 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2011-12-26 17:02:09 +0000 |
| commit | 86c462a8d5b9517738161eede77ccc6703af779b (patch) | |
| tree | 9c68ec3805ffe11713041fa8c7c00718f1f79030 /src/viewpoint.cpp | |
| parent | 084c8a9b85b853fa630d5a102cd102b45d543abf (diff) | |
displaying with overlays and distortion
Diffstat (limited to 'src/viewpoint.cpp')
| -rw-r--r-- | src/viewpoint.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/viewpoint.cpp b/src/viewpoint.cpp index 249084f..64a2b99 100644 --- a/src/viewpoint.cpp +++ b/src/viewpoint.cpp @@ -1,4 +1,5 @@ #include "viewpoint.h" +#define DEBUG 1 void viewpoint::setup(float w, float h, float x, float y) { window=ofRectangle(w,h,x,y); @@ -24,7 +25,7 @@ void viewpoint::setup(float w, float h, float x, float y) { vars[4].set('u','n',0.0,1.0,3.0,3.0); vars[5].set('j','h',0.0,1.0,3.0,3.0); vars[6].set('o','l',0.0,0.2,3.0,3.0); - vars[7].set('q','a',0,0.1,2.0,3.0); + vars[7].set('q','a',0,0.0001,2.0,3.0); } //-------------------------------------------------------------- void viewpoint::begin(){ @@ -44,8 +45,9 @@ void viewpoint::end(){ renderFBO.end(); camera.end(); - glPushMatrix(); + ofPushMatrix(); bindTexture(renderFBO); + //draw a grid //glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); ofNoFill(); @@ -59,28 +61,34 @@ void viewpoint::end(){ ofTranslate(ofGetWidth()/2,ofGetHeight()/2); for (float i = -1; i < 1.001; i+=(2.0f/gridY)){ + glBegin(GL_QUAD_STRIP); ofPoint p0; ofPoint p1; for (float j = -1; j < 1.001; j+=(2.0f/gridX)){ - p0=distort(ofPoint(j,i-(2.0f/gridY)),distortFactor); - p1=distort(ofPoint(j,i),distortFactor); + p0=distort(ofPoint(j,i-(2.0f/gridY)),vars[7].getVal()); + p1=distort(ofPoint(j,i),vars[7].getVal()); glTexCoord2f((j+1)*0.5,((i-(2.0f/gridY))+1)*0.5); - glVertex3f(p0.x*xStep,p0.y*yStep,0); + glVertex3f(p0.x*xStep,p0.y*yStep,-0.1); glTexCoord2f((j+1)*0.5,(i+1)*0.5); - glVertex3f(p1.x*xStep,p1.y*yStep,0); + glVertex3f(p1.x*xStep,p1.y*yStep,-0.1); } + glEnd(); + // } ofFill(); - glPopMatrix(); + unbindTexture(renderFBO); + ofPopMatrix(); + } //-------------------------------------------------------------- void viewpoint::keyPressed(int key){ for (int i=0;i<8;i++) vars[i].keyPressed(key); + if (DEBUG) printf("fov: %f distort: %f\n",vars[0].getVal(),vars[7].getVal()); } //-------------------------------------------------------------- void viewpoint::keyReleased(int key){ |
