summaryrefslogtreecommitdiff
path: root/TRRSS_01_rec
diff options
context:
space:
mode:
authorComment <tim@gray.(none)>2013-04-28 22:51:28 +0100
committerComment <tim@gray.(none)>2013-04-28 22:51:28 +0100
commit7c1399cfdd82eb9a387e8fb4aad15b1e17da7f5d (patch)
tree30a0eb6ad4b5b00b9306a3d26eef3a55c2d1000c /TRRSS_01_rec
parent29a366df4f1492a5974db87a215f1a310fc853a2 (diff)
nearly ready for rec
Diffstat (limited to 'TRRSS_01_rec')
-rwxr-xr-xTRRSS_01_rec/src/testApp.cpp87
-rwxr-xr-xTRRSS_01_rec/src/testApp.h4
2 files changed, 66 insertions, 25 deletions
diff --git a/TRRSS_01_rec/src/testApp.cpp b/TRRSS_01_rec/src/testApp.cpp
index 1c333bf..c43fd2d 100755
--- a/TRRSS_01_rec/src/testApp.cpp
+++ b/TRRSS_01_rec/src/testApp.cpp
@@ -73,39 +73,76 @@ void testApp::update(){
//--------------------------------------------------------------
void testApp::draw(){
- cam.begin();
+ //cam.begin();
//bind texture recordImage
//get point data from recordDepth
//draw textured polys and allow manipulation
+ float cloudWidth=1024.0f;
+ float cloudHeight=768.0f;
+
ofPushMatrix();
- ofTranslate(320,240,-1000);
+ ofTranslate((1024/2)-(640/2),(768/2)-(480/2),-500);
//ofRotate(0,0,1,180);
bindTex(recordImage.getTexture());
int step = 1;
- for(int y = step; y < 480; y += step) {
- glBegin(GL_QUADS);
- for(int x = step; x < 640; x += step) {
- ofPoint pos1 = recordUser.getWorldCoordinateAt(x-step, y-step, 0); //userID);
- ofPoint pos2 = recordUser.getWorldCoordinateAt(x, y-step, 0); //userID);
- ofPoint pos3 = recordUser.getWorldCoordinateAt(x-step, y, 0); //userID);
- ofPoint pos4 = recordUser.getWorldCoordinateAt(x, y, 0); //userID);
-
- if ((guiWin->distMin<pos1.z&&pos1.z<guiWin->distMax)&&
- (guiWin->distMin<pos2.z&&pos2.z<guiWin->distMax)&&
- (guiWin->distMin<pos3.z&&pos3.z<guiWin->distMax)&&
- (guiWin->distMin<pos4.z&&pos4.z<guiWin->distMax)) {
-
- glTexCoord2f(((float)x-step)/640.0f,((float)y-step)/480.0f);
- glVertex3f(pos1.x, -pos1.y,pos1.z);
- glTexCoord2f(((float)x)/640.0f,((float)y-step)/480.0f);
- glVertex3f(pos2.x, -pos2.y,pos2.z);
- glTexCoord2f(((float)x)/640.0f,((float)y)/480.0f);
- glVertex3f(pos4.x, -pos4.y,pos4.z);
- glTexCoord2f(((float)x-step)/640.0f,((float)y)/480.0f);
- glVertex3f(pos3.x, -pos3.y,pos3.z);
+
+ if (guiWin->drawPoints) {
+ // http://stackoverflow.com/questions/1513811/getting-smooth-big-points-in-opengl
+ glEnable( GL_POINT_SMOOTH );
+ glEnable( GL_BLEND );
+ glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ glPointSize( 6.0 );
+
+ glBegin(GL_POINTS);
+ glColor3f( 1.0f, 1.0f, 1.0f );
+
+ for(int y = step; y < 480; y += step) {
+
+ for(int x = step; x < 640; x += step) {
+ ofPoint pos1 = recordUser.getWorldCoordinateAt(x-step, y-step, 0); //userID);
+ ofPoint pos2 = recordUser.getWorldCoordinateAt(x, y-step, 0); //userID);
+ ofPoint pos3 = recordUser.getWorldCoordinateAt(x-step, y, 0); //userID);
+ ofPoint pos4 = recordUser.getWorldCoordinateAt(x, y, 0); //userID);
+
+ if ((guiWin->distMin<pos1.z&&pos1.z<guiWin->distMax)&&
+ (guiWin->distMin<pos2.z&&pos2.z<guiWin->distMax)&&
+ (guiWin->distMin<pos3.z&&pos3.z<guiWin->distMax)&&
+ (guiWin->distMin<pos4.z&&pos4.z<guiWin->distMax)) {
+
+ glVertex3f(pos4.x, pos4.y,pos4.z);
+ }
}
+ glEnd();
}
- glEnd();
+ }
+ else {
+ for(int y = step; y < 480; y += step) {
+ glBegin(GL_QUADS);
+ for(int x = step; x < 640; x += step) {
+ ofPoint pos1 = recordUser.getWorldCoordinateAt(x-step, y-step, 0); //userID);
+ ofPoint pos2 = recordUser.getWorldCoordinateAt(x, y-step, 0); //userID);
+ ofPoint pos3 = recordUser.getWorldCoordinateAt(x-step, y, 0); //userID);
+ ofPoint pos4 = recordUser.getWorldCoordinateAt(x, y, 0); //userID);
+
+ if ((guiWin->distMin<pos1.z&&pos1.z<guiWin->distMax)&&
+ (guiWin->distMin<pos2.z&&pos2.z<guiWin->distMax)&&
+ (guiWin->distMin<pos3.z&&pos3.z<guiWin->distMax)&&
+ (guiWin->distMin<pos4.z&&pos4.z<guiWin->distMax)) {
+
+ glTexCoord2f(((float)x-step)/640.0f,((float)y-step)/480.0f);
+ glVertex3f(pos1.x, pos1.y,pos1.z);
+ glTexCoord2f(((float)x)/640.0f,((float)y-step)/480.0f);
+ glVertex3f(pos2.x, pos2.y,pos2.z);
+ glTexCoord2f(((float)x)/640.0f,((float)y)/480.0f);
+ glVertex3f(pos4.x, pos4.y,pos4.z);
+ glTexCoord2f(((float)x-step)/640.0f,((float)y)/480.0f);
+ glVertex3f(pos3.x, pos3.y,pos3.z);
+ }
+ }
+ glEnd();
+ }
+
+
}
ofPopMatrix();
@@ -113,7 +150,7 @@ void testApp::draw(){
//recordImage.draw(0, 0, ofGetWidth(),ofGetHeight());
- cam.end();
+ //cam.end();
}
diff --git a/TRRSS_01_rec/src/testApp.h b/TRRSS_01_rec/src/testApp.h
index 1da9c6e..00316b0 100755
--- a/TRRSS_01_rec/src/testApp.h
+++ b/TRRSS_01_rec/src/testApp.h
@@ -56,6 +56,8 @@ class guiWindow: public ofxFensterListener{
ofxParameter<bool> drawPoints;
ofxFloatSlider pSize;
ofxParameter<float> pointSize;
+ ofxToggle iOut;
+ ofxParameter<bool> insideOut;
void setup(){
@@ -68,6 +70,8 @@ class guiWindow: public ofxFensterListener{
gui.add(dPoints.setup("draw points",drawPoints));
pointSize=2.0;
gui.add(pSize.setup("point size",pointSize,1.0,20.0,255));
+ insideOut=false;
+ gui.add(iOut.setup("inside out",drawPoints));
}
void draw() { gui.draw(); }