|
|
| Lags after changing resolution on-the-fly |
|
Frenzy
Member #13,868
December 2011
|
Hello, i have a little problem here, i have display running on some predefined WIDTH and HEIGHT .. when i try to switch to fullscreen from windowed and using al_get_display_mode, al_set_new_display_flags(ALLEGRO_FULLSCREEN) and then al_destroy_display and al_create_display with new screen resolution from `al_get_display_mod`e .. my screen really lags .. changing back to windowed (again on the fly) didn't help. I ve tried add counter before redrawing routine where is if(al_is_event_queue_empty(event_queue)) .. and counter is about 120 when it jumps in with normal screen but after resolution change it is about 600 Thanks for all advices |
|
Trezker
Member #1,739
December 2001
|
I wonder if this is related to the behavior I've had with multiple displays. When switching focus from one to the other it takes more than a second before events come through to my program. Might not be related at all though. |
|
Frenzy
Member #13,868
December 2011
|
Hm, maybe i use two monitors but dont work with it in allegro .. i will try to disconnect it EDIT: still same lags :/ |
|
jmasterx
Member #11,410
October 2009
|
It might lag because you lose your video bitmaps and they become memory bitmaps? Agui GUI API -> https://github.com/jmasterx/Agui |
|
Itachihro
Member #12,001
May 2010
|
jmasterx said: It might lag because you lose your video bitmaps and they become memory bitmaps? Very likely, this. Try reloading your bitmaps, see if that helps. |
|
Frenzy
Member #13,868
December 2011
|
Hmm that is highly possible .. i will definetly try it, but reloading mean only reloading or iniciating all bitmaps to null and then reload ? |
|
J-Gamer
Member #12,491
January 2011
|
I think you'd want to free the memory they used first, then reload them. " There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo |
|
Frenzy
Member #13,868
December 2011
|
Thank all of you. It's working now, it really was memory problem. Freeing memory and reloading bitmaps works |
|
Dario ff
Member #10,065
August 2008
|
Isn't there a way to do it without loading again from the disk?(which is probably the biggest bottleneck without an SSD) I mean, if there's both a memory and video bitmap copy, shouldn't it be possible to use al_clone_bitmap or something like that to recreate the video bitmap from the memory bitmap and send it to the GPU again with the new display? TranslatorHack 2010, a human translation chain in a.cc. |
|
Matthew Leverton
Supreme Loser
January 1999
|
Allegro 5.1 handles this automatically. Or you can use al_convert_bitmap() manually. |
|
torhu
Member #2,727
September 2002
|
al_clone_bitmap works on 5.0.x, but memory is wasted somewhere when you use it that way. |
|
Thomas Fjellstrom
Member #476
June 2000
|
torhu said: al_clone_bitmap works on 5.0.x, but memory is wasted somewhere when you use it that way. How much? I can't really imagine what it'd be unless you're forgetting to delete the old bitmap. -- |
|
torhu
Member #2,727
September 2002
|
I don't have a number for an individual bitmap, sorry. Memory use went up about 5 MB each time I cloned my 30 or so bitmaps. To try to reduce memory fragmentation, I tried cloning all bitmaps first, then destroying all in one go. But it didn't seem to matter. |
|
Thomas Fjellstrom
Member #476
June 2000
|
If you have a test case, or ever try it again, please report it -- |
|
|