Performance plummets after changing screen mode
After I destroy and recreate the display, my game's performance goes from about 2 ms per frame to 15+. In the menus, performance drops to around 10 seconds per frame. This made me wonder if it's the text drawing that has become slow, but increasing the amount of text drawn during the game only has a moderate, rather than disastrous, effect on frame rate.
I'm reloading all sprites and fonts after each screen mode change. Is there anything else I should be doing?
Resizing instead of recreating the display does not cause this problem.
Reloading ought to create bitmaps as video bitmaps on the new current display, but my guess is it isn't for some reason. Can you try al_get_bitmap_flags on any of your bitmaps to check if they are indeed video and not memory bitmaps.
Also, as I understand it, al_convert_memory_bitmaps should do the conversion without requiring you to reload at all.
Finally check that the new display is current when bitmaps are loaded - it should be made current when it is created (remember current display is per-thread) but you could use al_set_target_backbuffer to be sure.
If you could create a minimal example that would be useful!
al_convert_memory_bitmaps() isn't working. Some (or all?) bitmaps remain as memory bitmaps. If I call al_convert_bitmap each time I try to draw a memory bitmap, those bitmaps are converted, but the issue remains.
I realised I don't need to re-create the display to change mode, I just need to call al_resize_display and/or al_set_display_flag(screen, ALLEGRO_FULLSCREEN_WINDOW, !windowed).
Would I be right in thinking that requesting a particular refresh rate is meaningless for windowed or fullscreen windowed modes?
Does the resizing thing fix your problem now?
I don't know about refresh - it used to be relevant for CRT but modern displays don't have variable refresh rates?
I made this little prog:
on mac this does convert the bitmap to a memory bitmap and back. Does it work for you?
Thread #618255. Printed from Allegro.cc
Yes, resizing the window or switching between window and fullscreen window fixes the issue. Your code example works. However, I'm not sure the issue I was having has anything to do with any bitmaps I've created myself, as it only manifested in the menus, where only text is being drawn.