Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to achieve 30 frames per second using Android SurfaceView?

I am looking for example code sample that shows how to achieve 30 frames per seconds using Android SurfaceView? Assume each frame draws a circle starting at position x and y and each frame increments x and y by one.

Bonus question: On top of above I want to overlay another View to display text content so that whatever graphics is being drawn shows underneath this text content. How this can be done?

like image 547
ace Avatar asked Jan 30 '11 19:01

ace


1 Answers

If you want high frame rates, you really need to read up on GLSurfaceView. Under a normal surface view you are going to be at the mercy of the expense layout calculations and CPU centric rendering. With the GLSurfaceView you can offload that to the GPU and have a tight efficient control of layouts.

like image 117
Andrew White Avatar answered Nov 15 '22 05:11

Andrew White