From 4f1d5b3a6efe1de7885b37b091595f7bbc8a9b29 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 30 Dec 2011 21:13:07 +0000 Subject: succesfully combined camera and FBO --- src/testApp.cpp | 88 ++++++++------------------------------------------------- 1 file changed, 11 insertions(+), 77 deletions(-) (limited to 'src/testApp.cpp') diff --git a/src/testApp.cpp b/src/testApp.cpp index 8ff0865..10dbdf4 100644 --- a/src/testApp.cpp +++ b/src/testApp.cpp @@ -39,8 +39,8 @@ void testApp::setup(){ //bottleModel.setRotation(0, -90, 1, 0, 0); //bottleModel.setRotation(1, 270, 0, 0, 1); //bottleModel.setScale(0.9, 0.9, 0.9); - bottle.setPosition(ofGetWidth()/2, ofGetHeight()/2, -50); - board.setPosition(ofGetWidth()/2, ofGetHeight()/2, -50); + bottle.setPosition(0, 0, -50); + board.setPosition(0, 0, -50); //ofDisableArbTex(); @@ -88,10 +88,6 @@ void testApp::draw(){ switch(mode) { case CALIBRATE: - glPushMatrix(); - glTranslatef(ofGetWidth(),(ofGetHeight())+100,0); - //board.draw(); - int cx,cz; glFrontFace(GL_CW); @@ -109,17 +105,6 @@ void testApp::draw(){ } glEnd(); - -/* - glBegin(GL_QUADS); - glVertex3f(-100, 0,-100); - glVertex3f(100, 0,-100); - glVertex3f(100, 0,100); - glVertex3f(-100, 0,100); - glEnd(); - */ - glPopMatrix(); - //glFrontFace(GL_CCW); bottle.draw(); break; @@ -130,72 +115,21 @@ void testApp::draw(){ bottle.draw(); unbindTexture(texture); break; - } - //glPopMatrix(); - views[0].end(); - - - - - /* - - glPopMatrix(); - - views[0].renderFBO.draw(0,0); - - glPushMatrix(); - - */ - - if (mode!=NOTHING){ - + case NOTHING: - bindTexture(views[0].renderFBO); - glPushMatrix(); - //draw a grid - //glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); - ofNoFill(); - - ofSetLineWidth(1.0); - //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); - - 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)),views[0].distortFactor); - p1=distort(ofPoint(j,i),views[0].distortFactor); - glTexCoord2f((j+1)*0.5,((i-(2.0f/gridY))+1)*0.5); - 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.1); - } - glEnd(); - } - - ofFill(); - - - //renderFBO.getTextureReference().unbind(); - unbindTexture(views[0].renderFBO); - glPopMatrix(); - } + bindTexture(texture); + glPushMatrix(); + drawBox(50.0f); + unbindTexture(texture); + glPopMatrix(); + break; + } + views[0].end(); ofSetHexColor(0xFFFFFF); ofDrawBitmapString("fps: "+ofToString(ofGetFrameRate(), 2), 10, 15); - - // add polygons here - //glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); - - } //-------------------------------------------------------------- -- cgit v1.2.3