Exemplo n.º 1
0
void OpenSpace::render()
{
	drawBody(*upper, sf::Color::Black);
	drawBody(*middle, sf::Color::Black);

	drawBodies(bodies, sf::Color::Black, sf::Color::White, -2);
}
Exemplo n.º 2
0
void ofApp::draw(){

	ofSetWindowTitle(ofToString(ofGetFrameRate(), 1) + "fps"); 
	ofSetColor(255);
	if (bDraw3D) {

		mesh = kinect.getDepth()->getMesh(pointCloudOpts);

		ofEnableDepthTest();

		camera.update();
		camera.begin();

		ofPushMatrix();
		ofScale(100, 100, 100);
		{
			drawFloor();
			if (bDrawSensorDebug) drawSensorPosition();

			ofPushMatrix();
			ofMultMatrix(kinect.getBodyFrame()->getFloorTransform());
			{ 
				if (bDrawMesh) drawMesh();
				drawBodies();
				if (bDrawSensorDebug) drawFrustum();
			}
			ofPopMatrix();
		}
		ofPopMatrix();

		camera.end();

		ofDisableDepthTest();
	}
	else {
		kinect.getColor()->draw(0, 0, ofGetWidth(), ofGetHeight());
		kinect.getBodyFrame()->drawProjected(0, 0, ofGetWidth(), ofGetHeight());
	}
	drawFaceFeatures();
	drawGestures();
}
Exemplo n.º 3
0
void draw()
{
    GLfloat position[4] = {1, 1, 1, 0};

    // Clearing
    glClearColor(0, 0, 0.0f, 1);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // Setting camera

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();
    // Draw crosshair before lookat
    glLineWidth(1);
    glPushAttrib(GL_ENABLE_BIT);
    glDisable(GL_LIGHTING);
    draw2D();
    glPopMatrix();
    glPopAttrib();

    glMatrixMode(GL_MODELVIEW);

    gluLookAt(
        camPosition[0],
        camPosition[1],
        camPosition[2],
        camPosition[0] - camOrientation[2],
        camPosition[1] - camOrientation[5],
        camPosition[2] - camOrientation[8],
        camOrientation[1],
        camOrientation[4],
        camOrientation[7]
    );

    // Setting light position

    glLightfv(GL_LIGHT0, GL_POSITION, position);

    // Drawing

/*    glBegin(GL_LINES);
    {
        double *nearest = COL_queryLatestNearest();
//        double *lastImpulse = DYN_getLastImpulse();
        double *lastCollisionPoint = DYN_getLastCollisionPoint();
        glColor3f(1, 0, 0);
        glVertex3f(nearest[0], nearest[1], nearest[2]);
        glColor3f(0, 1, 0);
        glVertex3f(nearest[3], nearest[4], nearest[5]);
        glColor3f(1, 1, 0);
        glVertex3f(lastCollisionPoint[0], lastCollisionPoint[1], lastCollisionPoint[2]);
        glColor3f(1, 1, 0);
        glVertex3f(
            lastCollisionPoint[0] + lastCollisionPoint[0] * 20,
            lastCollisionPoint[1] + lastCollisionPoint[1] * 20,
            lastCollisionPoint[2] + lastCollisionPoint[2] * 20
        );
    }
    glEnd();*/

    drawAxes();
    drawGrid();
    drawBodies();
}