예제 #1
0
// Render Gantry based on the vertex representation defined at the top
void RenderUtils::RenderGantry(glm::uvec2 eyeSize, float angle, float x, float y){
  InitVAO();
  // This will identify our vertex buffer  
  GLuint vertexbuffer;
  // Generate 1 buffer, put the resulting identifier in vertexbuffer
  glGenBuffers(1, &vertexbuffer);
 // The following commands will talk about our 'vertexbuffer' buffer
  glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
  // Give our vertices to OpenGL.
  RotateObject(angle* PI / 180, x, y);
  glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_rotated_buffer_data), g_vertex_rotated_buffer_data, GL_STATIC_DRAW); 
  glEnableVertexAttribArray(0); 
  glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
  //std::cout << "checked" << std::endl;
  glVertexAttribPointer(
 			0,
 			3,
 			GL_FLOAT,
 			GL_FALSE,
 			0,
 			(void*)0
 			);
  //glRotatef(45,0.0f,0.0f,1.0f);
  glDrawArrays(GL_TRIANGLE_FAN, 0, 10);
  glDisableVertexAttribArray(0);
}
예제 #2
0
 void WorldObjectView::mouseMoveEvent(QMouseEvent *e)
 {
     if (left_mousebutton_pressed_)
     {
         if (update_timer_.elapsed() < 20)
             return;
         QPointF current_pos = e->posF();
         if (!last_pos_.isNull())
         {
             QPointF movement = current_pos-last_pos_;
             emit RotateObject(2*PI*movement.x()/width(),2*PI*movement.y()/height());
         }
         last_pos_ = current_pos;
         update_timer_.start();
     }
 }
예제 #3
0
void CGutUserControl::Update(float time_advance, CONTROLLER_TYPE type)
{
	m_eControllerType = type;

	switch(m_eControllerType)
	{
	case CONTROLLER_ROTATEOBJECT:
		RotateObject(time_advance);
		break;
	case CONTROLLER_FPSCAMERA:
		FPSCamera(time_advance);
		break;
	default:
		printf("Unsupported type!!\n");
		break;
	}
}