onTouch() slowdown worse with OpenGL?

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

onTouch() slowdown worse with OpenGL?

Postby astrath » Sun May 16, 2010 8:34 pm

After quite a bit of fiddling around I have got the GL version of my 2D game to running with 20-30fps with ~100 sprites. Now this is at least quite playable, until the user touches the screen. Then the fps is simply cut in halfe.

Now there are a lot of 2D games in the market like for example "Robo Defense" which seem to draw 100+ sprites with a static background and the user scrolling around by touching the screen quite fine. Feels like it has at least solid 20fps. So I thought maybe they are using Canvas.

So my question, has anyone benchmarked how big the slowdown is when using Canvas instead of OpenGL? Is it still as severe?
astrath
Junior Developer
Junior Developer
 
Posts: 12
Joined: Thu Apr 08, 2010 1:03 pm

Top

Postby ShadowKntSDS » Sun May 16, 2010 8:50 pm

While I personally have not done any benchmarks, I have heard of this issue. I believe it is far worse some of the older API levels (1.5-1.6ish) than with 2.1. I also know several people have mentioned sleeping the UI thread for a few ms when you handle a a touch event can partially mask the problem without affecting usability too much. I've tried this on some sims and see a drastically reduced number of call to my onTouch handler.
ShadowKntSDS
Junior Developer
Junior Developer
 
Posts: 15
Joined: Wed Apr 28, 2010 10:29 pm

Postby astrath » Sun May 16, 2010 8:56 pm

ShadowKntSDS wrote:While I personally have not done any benchmarks, I have heard of this issue. I believe it is far worse some of the older API levels (1.5-1.6ish) than with 2.1. I also know several people have mentioned sleeping the UI thread for a few ms when you handle a a touch event can partially mask the problem without affecting usability too much. I've tried this on some sims and see a drastically reduced number of call to my onTouch handler.


Yep, also read that, but my point was if anyone has observed any difference between Canvas and OpengGL and myTouch() slowdowns.
astrath
Junior Developer
Junior Developer
 
Posts: 12
Joined: Thu Apr 08, 2010 1:03 pm

Re: onTouch() slowdown worse with OpenGL?

Postby hardcoras » Mon May 17, 2010 4:45 pm

It has nothing to do with drawing tier (nor OpenGL nor Canvas). It's a bug in the android touch system implementation. You can read about it here: http://code.google.com/p/android/issues/detail?id=7836.
hardcoras
Experienced Developer
Experienced Developer
 
Posts: 62
Joined: Sat Nov 14, 2009 2:31 pm
Location: Lithunia

Re: onTouch() slowdown worse with OpenGL?

Postby astrath » Mon May 17, 2010 6:52 pm

hardcoras wrote:It has nothing to do with drawing tier (nor OpenGL nor Canvas). It's a bug in the android touch system implementation. You can read about it here: http://code.google.com/p/android/issues/detail?id=7836.


Yeah already read that and a few other posts about it. I just wondered if people find that for whatever reason (free CPU time, whatever) if you render to a GL surface instead of a Canvas one the decrease in available CPU is even worse. Okay, maybe there shouldn't be a connection here per se, was just wondering if writing a Canvas version of my app would be worth the trouble.
astrath
Junior Developer
Junior Developer
 
Posts: 12
Joined: Thu Apr 08, 2010 1:03 pm

Re: onTouch() slowdown worse with OpenGL?

Postby astrath » Mon May 17, 2010 6:55 pm

For example in the link you posted it says
" it is very bad for games, especially OpenGL ones."
which could mean that the author has found this issue to be even more severe with OpenGL rendering.

and

"This bug is primarily about the first gen devices based on the MSM7200
chip. That chip + an OpenGL game + this problem = bad user experience."


I just did my own little test using the Lunar Lander example game.
With 50 ships drawn on screen it gets 20fps, touching and moving slows it down to 10fps.
Which seems to be same 50% slowdown I get with my OpenGL app.
Strangely 50 sprites and still only getting 20fps seems a bit slow to me, even for canvas, but then I didn't check what else the sample is doing.

Knowing all that I'm a bit suprised that games like Robo Defense have a ton of stuff going on on the screen and use touch controls and still seem to mange a solid 20+fps.
astrath
Junior Developer
Junior Developer
 
Posts: 12
Joined: Thu Apr 08, 2010 1:03 pm

Top

Return to Android 2D/3D Graphics - OpenGL Tutorials

Who is online

Users browsing this forum: No registered users and 4 guests