Hey all, maybe I am way off base on this.. but I recall years ago messing
around with writing data to an off-screen buffer, then "flipping" the buffer
to video ram. I am guessing this is no longer done.. or is it? I thought the
reason for that years ago was it was much faster to write multiple layers of
a graphics scene, like side scrollers, even 3D scenes, in some off-screen
vram (or even regular memory), then swap the whole thing to the video ram
and doing that 30+ times a second yielded good performance. I apologize if
this is not how it's done any longer.. just wondering if that is still an
option and would help, or if that is so old school it's no longer ever done?


On Mon, Feb 1, 2010 at 11:56 AM, Federico Carnales
<fedecarna...@gmail.com>wrote:

> Hi Guich,
>
> I didn't do anything special to achieve 60fps with a SurfaceView, just
> get a lock to the surface and draw the bitmap onto the canvas. Mind
> you, I only get 60fps when drawing a static, full screen bitmap to the
> SurfaceView. If I draw more bitmaps on top of that background bitmap,
> the FPS goes down.
>
>
> Regards,
>
> Federico
>
>
> On Feb 1, 12:29 pm, guich <guiha...@gmail.com> wrote:
> > Hi Federico,
> >
> > I tried during weeks to get a working code for the opengles. The idea
> > was to draw an offscreen bitmap into the screen (i do all the graphics
> > rendering by myself). Then someone told me that using textures for
> > this was not a good idea, because it takes time to make the texture
> > get into the video card and then displayed.
> >
> > Since my knowledge of opengl is near 0, i gave up and used the
> > SurfaceView approach. I also published the code here:
> >
> > This goes at surfaceChanged:
> >
> >       sScreenBuff = ShortBuffer.allocate(w * h);
> >       sScreenBitmap = Bitmap.createBitmap(w, h,
> > Bitmap.Config.RGB_565);
> >
> > And this is my updateScreen method:
> >
> >    static void updateScreen()
> >    {
> >       try
> >       {
> >          if (sScreenBitmap == null)
> >             return;
> >          Canvas canvas = surfHolder.lockCanvas();
> >          if (canvas == null)
> >             return;
> >          instance.nativeOnDraw(sPixels); // call Native C code
> >          sScreenBuff.put(sPixels);
> >          sScreenBuff.rewind();
> >          sScreenBitmap.copyPixelsFromBuffer(sScreenBuff);
> >          canvas.drawBitmap(sScreenBitmap, 0, 0, null);
> >          surfHolder.unlockCanvasAndPost(canvas);
> >       }
> >       catch (Throwable t)
> >       {
> >          debug(Log.getStackTraceString(t));
> >       }
> >    }
> >
> > Have you done something different to achieve the 60fps?
> >
> > Btw, i can test your code in two devices, the G2 Ion and the Motorola
> > Milestone (A853).
> >
> > thanks and regards,
> >
> >    guich
>
> --
> 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+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to