Exemple #1
0
void do_redraw(char *userdata, GraphWin * wi)
{
  if ( TransformCompute(wi) ) {
    DrawTitle(userdata, wi);
    DrawLegend(userdata, wi);
    DrawGridAndAxis(userdata, wi);
    DrawData(userdata, wi);
    DrawLabel(userdata, wi);
  }
}
void ModelViewController::draw()
{
    if (!valid())
		{
		gui->RFP_Browser->callback( &tree_callback, gui );
		gui->RFP_Browser->redraw();

		glLoadIdentity();
		glViewport (0, 0, w(),h());											// Reset The Current Viewport
		glMatrixMode (GL_PROJECTION);										// Select The Projection Matrix
		glLoadIdentity ();													// Reset The Projection Matrix
		gluPerspective (45.0f, (float)w()/(float)h(),1.0f, 1000000.0f);						// Calculate The Aspect Ratio Of The Window
		glMatrixMode (GL_MODELVIEW);										// Select The Modelview Matrix
		glLoadIdentity ();													// Reset The Modelview Matrix
		ArcBall->setBounds((GLfloat)w(), (GLfloat)h());                 //*NEW* Update mouse bounds for arcball
		glEnable(GL_LIGHTING);
		for(int i=0;i<4;i++)
		{
			lights[i].Init((GLenum)(GL_LIGHT0+i));
			lights[i].SetAmbient(0.2f, 0.2f, 0.2f, 1.0f);
			lights[i].SetDiffuse(1.0f, 1.0f, 1.0f, 1.0f);
			lights[i].SetSpecular(1.0f, 1.0f, 1.0f, 1.0f);
			lights[i].Off();
		}

		lights[0].SetLocation(-100, 100, 200, 0);
		lights[1].SetLocation(100, 100, 200, 0);
		lights[2].SetLocation(100, -100, 200, 0);
		lights[3].SetLocation(100, -100, 200, 0);

		lights[0].On();
		lights[3].On();

		// enable lighting
		glDisable ( GL_LIGHTING);

		glDepthFunc (GL_LEQUAL);										// The Type Of Depth Testing (Less Or Equal)
		glEnable (GL_DEPTH_TEST);										// Enable Depth Testing
		glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);				// Set Perspective Calculations To Most Accurate

		quadratic=gluNewQuadric();										// Create A Pointer To The Quadric Object
		gluQuadricNormals(quadratic, GLU_SMOOTH);						// Create Smooth Normals
		gluQuadricTexture(quadratic, GL_TRUE);							// Create Texture Coords
	}
//    glEnable(GL_BLEND);
//    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);				// Clear Screen And Depth Buffer
	glLoadIdentity();												// Reset The Current Modelview Matrix
	glTranslatef(0.0f,0.0f,-zoom*2);								// Move Left 1.5 Units And Into The Screen 6.0

	glMultMatrixf(Transform.M);										// NEW: Apply Dynamic Transform
	CenterView();

    glPushMatrix();													// NEW: Prepare Dynamic Transform
	glColor3f(0.75f,0.75f,1.0f);


	/*--------------- Draw Grid and Axis ---------------*/

	DrawGridAndAxis();

	/*--------------- Draw models ------------------*/

	glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);

	Flu_Tree_Browser::Node *node = gui->RFP_Browser->get_selected( 1 );
	ProcessControl.Draw(node);

	/*--------------- Exit -----------------*/
	glPopMatrix();													// NEW: Unapply Dynamic Transform
	glFlush();														// Flush The GL Rendering Pipeline
//	swap_buffers();
}