Saturday, February 19, 2011

[android-developers] Re: How to get the best double buffering?

In fact, the whole idea is to *not* create a new bitmap on each
frame. Create the bitmap and clear it at the start of your animation,
then just keep drawing to this bitmap. You keep it in scope, so the
stuff you draw to the bitmap in previous frames is remembered. The
only additional overhead from what you are doing now is writing out
the bitmap when you have added all the new polygons for that frame.
This is just a block copy, and appears fast.

My animation loop works exactly this way, and whilst I haven't
measured how long it takes to write the bitmap, I can assure my
animation loop is very smooth.

On Feb 20, 4:40 am, Cliff Davies <cliff.dav...@gmail.com> wrote:
> Painting to a bitmap and copying to the canvas works fine and is ideal for
> what you're doing. No need to clear your bitmap between frames.
> On 19 Feb 2011 14:59, "MobileVisuals" <eyv...@astralvisuals.com> wrote:> I can't paint the whole screen for every frame, since the animation is
> > based on new polygons painting over the old ones. This creates a
> > pattern. If I painted over the old polygons, there would be no
> > pattern.
>
> > Peter Webb, you suggested that I should paint everything to a Bitmap.
> > Wouldn't that be too slow for an animation? I mean I would have to
> > create a new fullsize Bitmap for every frame.
> > -------------------------------
> > Sorry for the old redundant postings in this thread. They got posted
> > by mistake, since I tried to create a new thread, when it seemed like
> > the earlier thread was not posted.
>
> > On Feb 19, 10:49 am, MobileVisuals <eyv...@astralvisuals.com> wrote:
> >> Which approach to you think is the best for implementing double
> >> buffering?
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscribe@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

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

No comments:

Post a Comment