Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android: issues with ALLEGRO_NO_PRESERVE_TEXTURE and misleading docs #958

dos1 opened this Issue Nov 4, 2018 · 0 comments


None yet
1 participant
Copy link

dos1 commented Nov 4, 2018

When moving the Android app into the background, ALLEGRO_EVENT_DISPLAY_HALT_DRAWING/ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING event pair gets sent.


Note: Unlike ALLEGRO_EVENT_DISPLAY_FOUND it is not necessary to reload any bitmaps when you receive this event.

...but this is not what I observe. The source code also seems to disagree, at least on Android. The textures gets automatically backup and restored by Allegro, unless there's ALLEGRO_NO_PRESERVE_TEXTURE flag set to them.

Even the other part of the docs is contradicting itself:

The bitmap contents are lost when you get the ALLEGRO_EVENT_DISPLAY_LOST and ALLEGRO_EVENT_DISPLAY_HALT_DRAWING and a should be restored when you get the ALLEGRO_EVENT_DISPLAY_FOUND and when you call al_acknowledge_drawing_resume (after ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING event).

This also doesn't seem right, as I can't see anything in the iOS code that would backup and restore the bitmaps when those events are being sent. So, I deduce that in practice, HALT_DRAWING/RESUME_DRAWING loses texture data on Android, but does not on iOS.

Also, in case of ALLEGRO_NO_PRESERVE_TEXTURE bitmaps, it's expected to have their contents lost. However, when I tried to simply redraw their contents, the app was crashing. So I tried destroying and recreating - it still crashed. Then I just recreated the bitmap without destroying the old one - and it worked. Seems like ALLEGRO_NO_PRESERVE_TEXTURE bitmaps enter some weird state where I'm not sure if they got already destroyed by Allegro or just went unusable in some other way due to some bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.