I also had to fight this problem for a racing game. As Robert
suggested, average your delta times, it's the only way you can smooth
things out. I use a window of 5 frames per second for which i sum up
the delta times and divide by the number of frames. An example

15ms, 15ms, 33ms, 15ms, 15ms will give you an average delta time of
18.6ms for frame 6. The 33ms will also influence the delta time of the
next 4 frames after it. To avoid that effect you could use weighted
averaging: frame delta times that are newer receive a higher weight
(just an example, haven't boughtered using it)

On 2 Feb., 06:55, "[email protected]"
<[email protected]> wrote:
> I am already doing the animation in a time-based fashion. However,
> when I scroll the texture at a constant speed across the screen, I can
> see stuttering when the frame rate changes between 60fps and 30fps.
> Apparently the human eye is very good at detecting this kind of
> anomaly.
>
> On Feb 1, 4:35 pm, Robert Green <[email protected]> wrote:
>
> > What MrChaz said.  Use time-based animation and then if you want to
> > smooth out the rough spots, you can tick using a running average.
>
> > On Feb 1, 1:02 pm, MrChaz <[email protected]> wrote:
>
> > > The easiest way to achieve a smooth rotation is to multiply the
> > > rotation amount by the time difference between the current frame and
> > > the last frame - that way the amount moved is constant over time.
>
> > > On Feb 1, 5:18 pm, "[email protected]"
>
> > > <[email protected]> wrote:
> > > > Hello Android OpenGL/real-time gurus,
>
> > > > I am drawing a pretty simple scene, with one large texture the about
> > > > size of the screen (two triangles). I notice that the frame-rate is
> > > > irregular: in most of cases, a frame finishes in 17 ms. However, in
> > > > about 1 of 10 times, the frame finishes in 33ms.
>
> > > > My guess is probably some background services need to run. However,
> > > > the Linux scheduler is biased towards my FG app, so the BG services
> > > > are usually starved, until they can't take it anymore and they grab
> > > > the CPU from my app ....
>
> > > > I am seeing stuttering in the animation. Is this due to the irregular
> > > > frame rate? Should I delay each frame so that all frames are rendered
> > > > with 33ms frame time? If so, what's the best technique of achieving
> > > > this?
>
> > > > Is there an API that I can call to guarantee CPU resources for the
> > > > render thread .... I really hope Android runs on some sort of real
> > > > time kernel ...
>
> > > > Thanks!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to