[A5] iPhone4 performance

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

Set ALLEGRO_NO_PRESERVE_TEXTURE on your intermediate buffer.


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


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

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.


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

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.


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

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.

Thread #611056. Printed from Allegro.cc