示例#1
0
/**
 * Display callback. Draws the curves, points, and object
 */
void Display(void) {
	
	// clear buffers
  glClear(GL_COLOR_BUFFER_BIT);
  
	DrawGround(); // draw the ground
	
	// option to hide the controls
	if (!hide) {

		DrawControlPoints(); // draw all control points

		DrawAnimationPoints(); // draw the path for animation
	}

	// which scene
	if (scene1) {
		
		DrawBall(); // draw the ball
	} else {

		DrawLamp(); // draw the pixar lamp
	}

  glutSwapBuffers();
}
示例#2
0
void displayCallback()
{
  if (showMap == 1) {
    DrawParabolicMapWithCube();
  } else if (showMap == 2) {
    DrawParabolicMapWithSphere();
  } else {
    glEnable(GL_SCISSOR_TEST);
    for (int view = 0; view < 4; view++)
    {
      SelectViewport(view, true);
      if (view == ROTATE)
        DrawSurface();
      else
        DrawFrame();
      DrawGrid();
      if (view != ROTATE)
        DrawControlPoints();
    }
    glDisable(GL_SCISSOR_TEST);

    if (saveScreens)
      ScreenShot();
  }

  glutSwapBuffers();
}
示例#3
0
void BEZIER::Visualize(bool wireframe, bool fill, VERTEX color)
{
	if (!fill && !wireframe)
		return;
	
	//glPushAttrib(GL_ALL_ATTRIB_BITS);
	
	glDisable(GL_LIGHTING);
	glDisable(GL_TEXTURE_2D);
	
	if (fill)
	{
		glColor4f(1,1,1,1);
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
		//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		glDisable(GL_DEPTH_TEST);
		glEnable(GL_BLEND);
		glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
		float trans = 0.25;
		glColor4f(1,1,1,trans);
		DrawSurf(SURFDRAW_VIS, trans);
		glEnable(GL_DEPTH_TEST);
	}
	
	if (wireframe)
	{
		glDisable(GL_DEPTH_TEST);
		glLineWidth(1.0);
		glEnable(GL_BLEND);
		glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
		//glColor4f(.5,.6,.5,0.1);
		DrawControlPoints(color.x, color.y, color.z, 0.5);
		
		/*glEnable(GL_DEPTH_TEST);
		glDisable(GL_BLEND);
		glLineWidth(2.0);
		//glColor4f(color.x, color.y, color.z,1);
		DrawControlPoints(color.x, color.y, color.z, 1);*/
	}
	
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	//glPopAttrib();
	glEnable(GL_LIGHTING);
	glEnable(GL_TEXTURE_2D);
}