admin管理员组文章数量:1430621
I am building a canvas based web game that runs at 60fps in chrome on the desktop. It also runs at 60fps in chrome on android. I loaded it into a phonegap application and the fps meter still reads 60fps, but the screen is only getting drawn every few ticks. Is there a refresh rate limiter that is forcing the webview to only draw every once a second or so? What other things could be limiting my drawing, even when the website says its redrawing at 60fps?
I am building a canvas based web game that runs at 60fps in chrome on the desktop. It also runs at 60fps in chrome on android. I loaded it into a phonegap application and the fps meter still reads 60fps, but the screen is only getting drawn every few ticks. Is there a refresh rate limiter that is forcing the webview to only draw every once a second or so? What other things could be limiting my drawing, even when the website says its redrawing at 60fps?
Share Improve this question asked Feb 9, 2014 at 11:15 DestedDested 6,43312 gold badges53 silver badges73 bronze badges 3- Maybe would you have better performance with the following plugin (needs full screen canvas and does not implement all canvas functions) github./phonegap/phonegap-plugin-fast-canvas – QuickFix Commented Feb 9, 2014 at 11:39
-
Are you controlling the redraws with
requestAnimationFrame
? – fny Commented Feb 16, 2014 at 0:36 - I will look into fastcanvas, but I was hoping I would not have to. Yes I am using requestanimationframe – Dested Commented Feb 17, 2014 at 22:37
2 Answers
Reset to default 6 +200PhoneGap by default will use the built in default browser, which is not chrome, unless you are working with KitKat, but that is a different story.
Now I had problems myself with the default browser even on small canvas project like getting a user signature, but that was due to low rate of touchevent fires...
Anyway the possible solution will be to force phonegap to use WebChromeClient instead of the default one, you can do that by adding following line before the super.loadUrl
call:
appView.setWebChromeClient(new WebChromeClient());
If you do force to use WebChromeClient make sure you do enable javascript, local storage if you need it and so on. Also it's possible that some PhoneGap plugins will break. If you game is pure HTML5 than I suggest considering not using phonegap for your android version, building a simple WebView app it is quite easy in Android.
Also if your game intend to use acceleration sensor, have a look at what is the native support for browsers: Can I Use resources
Also I will definitely read THIS and THIS
Hope it helped. Emil
Sadly, the new Webview does not have all the same features as Chrome. One of these differences is the WebGL 3D canvas that Chrome uses. See here for a list of feature differences between the new Webview and Chrome.
本文标签: javascriptPhonegap canvas low refresh rateStack Overflow
版权声明:本文标题:javascript - Phonegap canvas low refresh rate - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745527270a2661895.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论