[ODE] ode and glut

Jon Watte (ODE) hplus-ode at mindcontrol.org
Sat Nov 25 11:26:51 MST 2006


Typically, you will measure the amount of time that's elapsed since the 
last timer call, add that to your time accumulator, and then step your 
fixed-step simulator enough to reduce the accumulator to less than a 
single time step.

double timeAccum;
double lastTime;

myGlutTimer() {
  double now = currentTimeInSeconds();
  timeAccum += (now - lastTime);
  lastTime = now;
  while (timeAccum >= TIME_STEP_SIZE) {
    collideStuff();
    stepWorld(TIME_STEP_SIZE);
    timeAccum -= TIME_STEP_SIZE;
  }
}


Basak Alper wrote:
> Hi again,
> My actual question was how to integrate ode loop within a glut loop.
> I achieved to do some so far, but I have more specific questions now.
> I call the ODE initializations within the glut init func. Then I am 
> calling simLoop of ode within the timer func. of glut. I did so, 
> because simLoop has no such consistency. It runs faster on a small 
> screen. But called in timer function
> it seems like running much slower.
> Other than that, the contact group is emptied at the end of each 
> simLoop. I am not sure where should I be calling the following functions.
>
>   dJointGroupDestroy (contactgroup);
>   dSpaceDestroy (space);
>   dWorldDestroy (world);
>
> Currently I am calling these in the main function after calling 
> glutMainLoop(). I am seeing a simulation but I need to know if I am in 
> the right direction.
> Thanks,
> basak
>
>
> On 11/24/06, *Gussimulator* <gussimulator at yahoo.com.ar 
> <mailto:gussimulator at yahoo.com.ar>> wrote:
>
>     His actual question was "how do I compile without any extras, just the
>     physics simulation code".
>
>     Please read carefuly... just because he mentions he wants to add
>     shaders
>     using glut doesnt mean hes asking you how to achive such thing....
>
>
>
>
>     ----- Original Message -----
>     From: "Christoph Frick" <frick at sc-networks.com
>     <mailto:frick at sc-networks.com>>
>     To: "Basak Alper" < basakalper at gmail.com
>     <mailto:basakalper at gmail.com>>
>     Cc: <ode at q12.org <mailto:ode at q12.org>>
>     Sent: Thursday, November 23, 2006 8:06 AM
>     Subject: Re: [ODE] ode and glut
>
>
>     > _______________________________________________
>     > ODE mailing list
>     > ODE at q12.org <mailto:ODE at q12.org>
>     > http://q12.org/mailman/listinfo/ode
>     >
>
>     _______________________________________________
>     ODE mailing list
>     ODE at q12.org <mailto:ODE at q12.org>
>     http://q12.org/mailman/listinfo/ode
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>   


More information about the ODE mailing list