Beispiel #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();
}
//Called to update the display.
//You should call glutSwapBuffers after all of your rendering to display what you rendered.
//If you need continuous updates of the screen, call glutPostRedisplay() at the end of the function.
void display()
{
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
	glClearDepth(1.0f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	if (g_pConeMesh && g_pCylinderMesh && g_pCubeTintMesh && g_pCubeColorMesh && g_pPlaneMesh)
	{
		const glm::vec3 &camPos = ResolveCamPosition();

		glutil::MatrixStack camMatrix;
		camMatrix.SetMatrix(CalcLookAtMatrix(camPos, g_camTarget, glm::vec3(0.0f, 1.0f, 0.0f)));

		glBindBuffer(GL_UNIFORM_BUFFER, g_GlobalMatricesUBO);
		glBufferSubData(GL_UNIFORM_BUFFER, sizeof(glm::mat4), sizeof(glm::mat4), glm::value_ptr(camMatrix.Top()));
		glBindBuffer(GL_UNIFORM_BUFFER, 0);

		glutil::MatrixStack modelMatrix;

		//Draw Scene
		DrawRoom(modelMatrix);
		DrawArmchair(modelMatrix);
		DrawTable(modelMatrix);
		DrawCarpet(modelMatrix);
		DrawLowTable(modelMatrix);
		DrawPicture(modelMatrix);
		DrawLamp(modelMatrix);
		DrawPlant(modelMatrix);
		DrawCandlesInLoop(modelMatrix);
	}

	glutSwapBuffers();
	glutPostRedisplay();
}
//---------------------------------------------------------------------------
void TFormPar64::UpdateBuffer()
{
  switch (mDisplayMode)
  {
    case modeView:
      ImageBuffer->Canvas->Draw(0,0,ImageView->Picture->Graphic);
      break;
    case modeUse:
      //Update images
      DrawLamp(ImageLamp,mPar64->GetLightIntensity(),255,255,0);
      //Update buffer
      ImageBuffer->Canvas->Draw(0,0,ImageWatermark->Picture->Graphic);
      DrawOnBuffer(ImageLamp);
      break;
    case modeConnect:
      ImageBuffer->Canvas->Draw(0,0,ImageWatermark->Picture->Graphic);
      DrawOnBuffer(ImagePlug220);
      break;
    default: assert(!"Should not get here");
  }

  DrawBorderAroundBuffer();
  //Drawing is done by TFormSimStagecraftMain
}