Exemplo n.º 1
0
void KinectViewer::display(GLContextData& contextData) const
	{
	if(cameraDevice!=0)
		{
		/* Move the camera projector to the tracking device's position and orientation in physical space: */
		glPushMatrix();
		glMultMatrix(cameraDevice->getTransformation());
		glRotated(90.0,1.0,0.0,0.0);
		glScaled(1.0/2.54,1.0/2.54,1.0/2.54);
		
		glBegin(GL_LINES);
		glColor3f(1.0f,0.0f,0.0f);
		glVertex3f(0.0f,0.0f,0.0f);
		glVertex3f(100.0f,0.0f,0.0f);
		glColor3f(0.0f,1.0f,0.0f);
		glVertex3f(0.0f,0.0f,0.0f);
		glVertex3f(0.0f,100.0f,0.0f);
		glColor3f(0.0f,0.0f,1.0f);
		glVertex3f(0.0f,0.0f,0.0f);
		glVertex3f(0.0f,0.0f,100.0f);
		glEnd();
		}
	
	/* Process all streamers: */
	for(std::vector<KinectStreamer*>::const_iterator sIt=streamers.begin();sIt!=streamers.end();++sIt)
		(*sIt)->display(contextData);
	
	if(cameraDevice!=0)
		{
		/* Return to navigational space: */
		glPopMatrix();
		}
	
	#if 0
	/* Draw the animated model: */
	glPushMatrix();
	glTranslated(7.71,-29.37,-94.57);
	glScaled(0.2,0.2,0.2);
	glRotated(120.0,0.0,1.0,0.0);
	glRotated(-90.0,1.0,0.0,0.0);
	anim.glRenderAction(contextData);
	glPopMatrix();
	#endif
	}
Exemplo n.º 2
0
void ScreenCalibrator::display(GLContextData& contextData) const
	{
	/* Set up OpenGL state: */
	glPushAttrib(GL_ENABLE_BIT|GL_LINE_BIT|GL_POINT_BIT);
	glDisable(GL_LIGHTING);
	glPointSize(3.0f);
	
	/* Get the tracking point mover's transformation: */
	Vrui::NavTrackerState scaledDeviceT=Vrui::getInverseNavigationTransformation();
	scaledDeviceT*=trackingPointsMover->getTransformation();
	
	/* Calculate the point transformation: */
	Vrui::TrackerState pmt=Vrui::TrackerState(scaledDeviceT.getTranslation(),scaledDeviceT.getRotation());
	pmt*=trackingPointsTransform;
	pmt=Vrui::TrackerState::identity;
	
	/* Draw all tracking and survey points: */
	glBegin(GL_POINTS);
	glColor3f(1.0f,1.0f,0.0f);
	for(PointList::const_iterator tpIt=trackingPoints.begin();tpIt!=trackingPoints.end();++tpIt)
		glVertex(pmt.transform(*tpIt));
	glColor3f(0.0f,1.0f,0.0f);
	for(PointList::const_iterator spIt=screenPoints.begin();spIt!=screenPoints.end();++spIt)
		glVertex(*spIt);
	glColor3f(1.0f,0.0f,0.0f);
	for(PointList::const_iterator fpIt=floorPoints.begin();fpIt!=floorPoints.end();++fpIt)
		glVertex(*fpIt);
	glColor3f(1.0f,0.0f,1.0f);
	for(PointList::const_iterator bpIt=ballPoints.begin();bpIt!=ballPoints.end();++bpIt)
		glVertex(*bpIt);
	glEnd();
	
	/* Draw all tracker calibration pairs: */
	size_t numPoints=trackingPoints.size();
	if(numPoints>ballPoints.size())
		numPoints=ballPoints.size();
	glBegin(GL_LINES);
	for(size_t i=0;i<numPoints;++i)
		{
		glColor3f(1.0f,1.0f,0.0f);
		glVertex(pmt.transform(trackingPoints[i]));
		glColor3f(1.0f,0.0f,1.0f);
		glVertex(ballPoints[i]);
		}
	glEnd();
	
	/* Draw the screen rectangle: */
	glBegin(GL_LINE_LOOP);
	glColor3f(0.0f,1.0f,0.0f);
	glVertex(screenTransform.transform(Point(0,0,0)));
	glVertex(screenTransform.transform(Point(screenSize[0],0,0)));
	glVertex(screenTransform.transform(Point(screenSize[0],screenSize[1],0)));
	glVertex(screenTransform.transform(Point(0,screenSize[1],0)));
	glEnd();
	
	/* Draw the projected screen quadrangle: */
	glBegin(GL_LINE_LOOP);
	glColor3f(0.0f,0.0f,1.0f);
	glVertex(pScreenTransform.transform(Point(0,0,0)));
	glVertex(pScreenTransform.transform(Point(1,0,0)));
	glVertex(pScreenTransform.transform(Point(1,1,0)));
	glVertex(pScreenTransform.transform(Point(0,1,0)));
	glEnd();
	
	/* Reset OpenGL state: */
	glPopAttrib();
	}