Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [A5] iPhone4 performance

This thread is locked; no one can reply to it. rss feed Print
[A5] iPhone4 performance
thebignic
Member #14,419
July 2012

On my iPhone4, I'm only getting MAX 40fps with my app which is basically just an event loop.

The event loop should be firing at 60fps (which is my target, and works fine on PC version)

All the draw routine does is draw the FPS to a buffer (160x240), draw a scaled up version of that buffer to the backbuffer (320x480), and then flip the display.

I've set ALLEGRO_FULLSCREEN and ALLEGRO_OPENGL as new display flags.

Are there some OpenGL specifics that I'm not setting up right? Is it doing the drawing in software perhaps?

Kinda flummoxed...

Trent Gamblin
Member #261
April 2000
avatar

Set ALLEGRO_NO_PRESERVE_TEXTURE on your intermediate buffer.

thebignic
Member #14,419
July 2012

OMG Thank you Trent. Totally did the trick. I was getting so scared :)

jmasterx
Member #11,410
October 2009

Should that flag be set for any intermediate buffer? It might explain why I was getting terrible frame rates from using an intermediate buffer. Why is it slower? I would have thought it just uselessly uses more memory to preserve it.

Trent Gamblin
Member #261
April 2000
avatar

It should be set for anything you draw into regularly, as a rule of thumb. It uses more memory AND it's a lot slower. It's not drawing to another texture, it has to download the data off the gpu which is very slow to do each frame.

thebignic
Member #14,419
July 2012

How can I set this for only one bitmap though? Seems to be global, with no way of disabling it?

Is there a DX/OpenGL reason why we can't do this per bitmap?

Thomas Fjellstrom
Member #476
June 2000
avatar

That function sets up parameters for creating a new bitmap. You can always reset the new flags before creating other bitmaps, and the first buffer will still keep its settings.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

thebignic
Member #14,419
July 2012

So call it with no parameters should clear all the flags? DUR!

Also, in iPhone, is it neccesary to indicate ALLEGRO_VIDEO_BITMAP? I've been told that its all shared memory so I'm wondering if this is necessary/helpful?

Thomas Fjellstrom
Member #476
June 2000
avatar

The default is ALLEGRO_VIDEO_BITMAP afaik. I think it's better to call al_get_new_bitmap_flags to get the flags before you set ALLEGRO_NO_PRESERVE_TEXTURE, then restore the flags to the previously saved value.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Go to: