101 moving smileys => 60 frames per second

Erel

B4X founder
Staff member
Licensed User
Longtime User
SS-2012-07-16_13.05.51.png


Starting with Android 3.0 it is possible to use hardware acceleration with the standard views. Hardware acceleration is about 5-10 times faster than the software based drawings.

As you can see in the above image all 101 smileys are redrawn on every "tick". The frame rate is between 55 to 65 frames per second.

This will be the base of a new library and framework...
 

Jim Brown

Active Member
Licensed User
Longtime User
Great stuff. This has been one of the drawbacks with software drawing - slow rendering. It prompted me to create an OpenGL based 2D libray. Looking forward to the next update
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Cool!.

Also, I would suggest you make that example an app and post it on the market and charge 99 cents, it will go viral you'll be a millionaire in no time, people seem to buy this kind of silly apps :p
 
Upvote 0

Jim Brown

Active Member
Licensed User
Longtime User
This solution will only be able to use hardware acceleration with Android 3.0 or above. So solutions based on OpenGL do have an advantage if you target Android 2.x devices as well
Yes. Good point.
Could you post the source and smiley Erel? It would be interesting to see how OpenGL stands up. I am assuming it is equally capable.
 
Upvote 0

Jim Brown

Active Member
Licensed User
Longtime User
Where do you find the FPS when testing apps?
I do mine FPS timing like this:

B4X:
'snippet of FPS code
Sub Process_Globals
   Dim time As Timer
End Sub

Sub Globals
   'fps variables
   Dim frameCount As Int
   Dim oldTime,FPS As Long
End Sub

Sub Activity_Create(FirstTime As Boolean)
   time.Initialize("Timer1",10)
End Sub

Sub Activity_Resume
   time.Enabled=True
End Sub

Sub Activity_Pause (UserClosed As Boolean)
   time.Enabled=False
End Sub

Sub Timer1_Tick
   '
   ' DO DRAWING STUFF
   '
   ' FPS monitor
   If DateTime.Now>oldTime Then
      oldTime=DateTime.now+1000
      FPS=frameCount :  frameCount=0
   Else
      frameCount=frameCount+1
   End If
   somelabel.Text="FPS:" & FPS
End Sub
 
Upvote 0
Top