Esempio n. 1
0
void FitTest::draw() 
{
    m_drawer->geometry(m_allGeo);
	// m_drawer->linearCurve(*m_curve);
	//m_drawer->smoothCurve(*m_curve, 8);
	//glBegin(GL_POINTS);
	//unsigned i=0;
	
	//glColor3f(0.f, 0.f, .5f);
	//for(;i<m_numSamples;i++)
	//	glVertex3fv((GLfloat *)&m_samples[i]);
	//glEnd();
	//glColor3f(0.8f, 0.f, 0.f);
	//for(i=1; i<m_numReducedP+1; i++)
		//m_drawer->arrow(m_reducedP[i-1], m_reducedP[i]);
	
	// int vv[2];
	// int ee[2];
	// float dV, dE;
	// Vector3F a, b, c, d;
	//for(i=0; i<m_numGroups; i++) {
		//drawOctahedron(m_octa[i]);
		/*if(i>0) {
			dV = m_octa[i].movePoleCost(vv, m_octa[i-1]);
			
			dE = m_octa[i].moveEdgeCost(ee, m_octa[i-1]);
			
			if(dV <= dE) {
				glColor3f(.5f, .5f, 0.f);
				m_drawer->arrow(m_octa[i].p()[vv[0]], m_octa[i-1].p()[vv[1]]);
			}
			else {
				glColor3f(0.f, .5f, .5f);
			
				m_octa[i].getEdge(a, b, ee[0]);
				m_octa[i-1].getEdge(c, d, ee[1]);
				m_drawer->arrow(a, c);
				m_drawer->arrow(b, d);
			}
		}*/
	//}
	
	glColor3f(.8f, .8f, .8f);
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
#if DGB_DRAW
	
#else
	drawTetrahedron();
#endif
	glColor3f(.128f, .28f, .128f);
	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
	drawTetrahedron();
	
#if DGB_DRAW
	drawOctahedron(m_drawer);
	drawSamples(m_drawer);
#endif
}
Esempio n. 2
0
// The window display callback function.
// This function is responsible for drawing the contents of a window.
// One can safely assume that the reshape callback for a window has
// been called at least once before the display callback is invoked.
void display()
{
	// Clear the window.
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	// Set the current matrix to the modelview matrix.
	glMatrixMode(GL_MODELVIEW);

	// Save the current modelview matrix.
	glPushMatrix();

	// Set the eye position.
	// The eye is always oriented to look towards the origin.
	GLfloat eyeX = 5 * cos(degToRad(theta));
	GLfloat eyeY = 5 * sin(degToRad(theta));
	GLfloat eyeZ = ro;
	gluLookAt(eyeX, eyeY, eyeZ, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0);

	// Draw the coordinate axes.
	drawAxes();

	// Draw a cube at 1.5,-1.5, 0
	glPushMatrix();
	glColor3f(0.0, 0.0, 0.9);
	glTranslatef(-1.5, 1.5, 0.0);
	glScalef(0.5, 0.5, 0.5);
	glutSolidCube(1);
	glPopMatrix();

	//draw a sphere at the origin
	glPushMatrix();
	glColor3f(0.9, 0.0, 0.9);
	glTranslatef(0.0, 0.0, 0.0);
	glScalef(0.5, 0.5, 0.5);
	glutSolidSphere(0.7071, 10, 10);
	glPopMatrix();

	//draw a tetrahedron
	glPushMatrix();
	glTranslatef(1.5, -1.5, 0.0);
	glScalef(0.5, 0.5, 0.5);
	drawTetrahedron();
	glPopMatrix();

	// Restore the old modelview matrix.
	glPopMatrix();

	// Flush the graphics output to the framebuffer.
	glutSwapBuffers();
}