Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Canvas vs OpenGL for 2D Games  (Read 7311 times)
0 Members and 1 Guest are viewing this topic.
Offline lsgames

Senior Newbie





« Posted 2010-06-16 12:55:09 »

After having spent 1 month rewriting one of our 2D games from Canvas to OpenGL we got the idea we should have had before starting the work: To investigate if this actually would give a higher FPS or not. The short answer is "no". The long answer is that it (big surprise) depends alot on the device. Wanted to post our findings here. Maybe someone can learn from them or has some comments.

Executive summary

It is a world of compromise:
- The high-end, 1Ghz devices out there have way better performance on Canvas than OpenGL
- The low-end (G1, dream, hero,..) devices have best performance on OpenGL
- If you start doing rotations, scaling, applying semi-transparancy OpenGL gains on Canvas

Test Cases

You can download the test here:

http://logisoftgames.com/downloads/

It is an extension of Chris Pruetts Sprite Method Test. You can also find data from the phones we ran it on - G1, Nexus 1, Droid.

If you are in posession of another device we would be VERY interested in having you run the test on that device and let us know the output (found in LogCat). Just install the APK and press "Run Batch". It will go for a while - up to 2 hours. Could be cool to get more data to get a clearer picture of the situation.

/Martin
Offline PaulReeves

Senior Newbie





« Reply #1 - Posted 2010-06-16 15:02:41 »

Interesting stuff, I had naturally assumed that openGL would be faster on all hardware.
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #2 - Posted 2010-06-17 01:15:27 »

[...]
It is a world of compromise:
- The high-end, 1Ghz devices out there have way better performance on Canvas than OpenGL
- The low-end (G1, dream, hero,..) devices have best performance on OpenGL
- If you start doing rotations, scaling, applying semi-transparancy OpenGL gains on Canvas
[...]

Actually, this suggests it was totally worth it. You made the worst case scenario less bad. I.e. you can now draw a bit more and it will still work fine on both generations of devices.

The best case scenario is usually not very interesting. E.g. in a first person shooter no one cares if you get 200 or 1000 frames when facing a wall.

弾幕 ☆ @mahonnaiseblog
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline lsgames

Senior Newbie





« Reply #3 - Posted 2010-06-17 07:39:24 »

Yes that is a good point oNyx. Forgot to mention the devices running a Software renderer (HTC Tattoo among others). They are almost 5-10% of our players. They emulate hardware acceleration in software and thus have pretty poor OpenGL performance. On Tattoo the framerate was reduced to 10 which is not very playable.
Offline lsgames

Senior Newbie





« Reply #4 - Posted 2010-06-17 07:41:33 »

I think if you want to give all players the best possible experience it is a good idea to implement both a software renderer and an OpenGL renderer and make an automatic choice on startup which the user can alter in a settings page in case the app chose poorly.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (37 views)
2014-10-17 03:59:02

Norakomi (28 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (28 views)
2014-10-15 16:18:58

TehJavaDev (52 views)
2014-10-14 00:39:48

TehJavaDev (54 views)
2014-10-14 00:35:47

TehJavaDev (42 views)
2014-10-14 00:32:37

BurntPizza (64 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (77 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!