Exemplo n.º 1
0
void PhysicsLoop( void )
{
  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

  RenderString( 1, 2, "Left click to spawn a polygon" );
  RenderString( 1, 4, "Right click to spawn a circle" );

  static float accumulator = 0;
  accumulator += clock.Elapsed( );
  clock.Start( );

  accumulator = Clamp( 0.0f, 0.1f, accumulator );
  while(accumulator >= dt)
  {
    if(!frameStepping)
      scene.Step( );
    else
    {
      if(canStep)
      {
        scene.Step( );
        canStep = false;
      }
    }
    accumulator -= dt;
  }

  clock.Stop( );

  scene.Render( );

  glutSwapBuffers( );
}
Exemplo n.º 2
0
void PhysicsLoop( void )
{
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

	i32 w = glutGet( GLUT_WINDOW_WIDTH );
	i32 h = glutGet( GLUT_WINDOW_HEIGHT );
	Reshape( w, h );

	static float accumulator = 0;

	accumulator += g_clock.Start( ) * 0.5f;

	accumulator = q3Clamp01( accumulator );
	while ( accumulator >= dt )
	{
		if ( !frameStepping )
			scene.Step( );

		else
		{
			if ( canStep )
			{
				scene.Step( );
				canStep = false;
			}
		}

		accumulator -= dt;
	}

	g_clock.Stop( );

	scene.Render( &renderer );

	glutSwapBuffers( );
}