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 For more options, visit this group at http://groups.google.com/group/android-developers?hl=en