Exemplo n.º 1
0
/*!*****************************************************************************
 *******************************************************************************
\note  idle
\date  June 1999
   
\remarks 

      The function called by openGL whenever processing time available.

 *******************************************************************************
 Function Parameters: [in]=input,[out]=output


 ******************************************************************************/
void
idle(void)

{
  int i;
  struct timeval t;
  static double last_draw_time = 0.0;
  double current_time;


  //-------------------------------------------------------------------------
  // the main functions are the most handy in an include file

#include "SL_user_idle_core.h"

  // update the eye view positions
  updateEyes();


  //-------------------------------------------------------------------------
  // refresh display

  gettimeofday(&t,NULL);
  current_time = (double) t.tv_sec + ((double)t.tv_usec)/1.e6;

  if (current_time-last_draw_time >= 1./window_update_rate) {
    glutPostRedisplayAll();
    last_draw_time = current_time; 
  }

}
Exemplo n.º 2
0
/*!*****************************************************************************
 *******************************************************************************
\note  idle
\date  June 1999
   
\remarks 

      The function called by openGL whenever processing time available.
      Here, the servo-loops are implemented

 *******************************************************************************
 Function Parameters: [in]=input,[out]=output


 ******************************************************************************/
void
idle(void)

{
  int i;
  static double last_draw_time=0;
  int    integrate_method = INTEGRATE_EULER;
  double n_integration    = 1;

  // the core component of the idle task is conveniently included
#include "SL_user_idle_core.h"
  
  // the numerical integration
#include "SL_user_integrate.h"
  
  /* refresh display */
  if (servo_time-last_draw_time > window_update_rate) {
    glutPostRedisplayAll();
    last_draw_time = servo_time; 
  }

}