|
[A5] Should I bother updating only part of the screen? |
torhu
Member #2,727
September 2002
|
I've been porting my old A4 game to A5. The new API is pretty nice, with more consistent and easier to remember names and parameter orders than the old one (maybe except for al_key_down, hehe). I don't know much about how hardware accelerated rendering works, so here goes. My A4 game used double buffering, and updates only the changed parts of the buffer, before blitting the whole thing to the screen. For A5, I just removed the old backbuffer and draw to the default target instead, then call al_flip_display. This worked in windowed mode (Direct3D), but in fullscreen mode it seems to be using page flipping. At least it's doing something that breaks my partial updating scheme. Which in hindsight is obvious that I would have to expect. Should I just update the whole screen every frame? I suppose I could use a video bitmap for double buffering and keep the partial updating system, but that seems a bit pointless. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
torhu said: Should I just update the whole screen every frame? I suppose I could use a video bitmap for double buffering and keep the partial updating system, but that seems a bit pointless. I was wondering this myself as I have a gui based on double buffering too. I have some functions that only draw to a specific portion of the screen and if A5 is using page flipping then I could end up with a flickering background image when I run those functions. Should I draw the same background to the back buffer twice (once before flipping, and once afterwards) before running my functions? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Matthew Leverton
Supreme Loser
January 1999
|
If al_get_display_option() returns ALLEGRO_UPDATE_DISPLAY_REGION, then you can use al_update_display_region(). Manual says it could be faster. But if you use al_flip_display(), then I would assume you must completely redraw the entire back buffer if you want to avoid undefined behavior. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Under al_set_new_display_option, I found the option ALLEGRO_SINGLE_BUFFER. Perhaps this would solve the issue? 1al_set_new_display_option(ALLEGRO_SINGLE_BUFFER , 1 , ALLEGRO_REQUIRE);
2display = al_create_display(width , height);
3if (!display) {return 1;}// not supported
My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
torhu
Member #2,727
September 2002
|
ALLEGRO_SINGLE_BUFFER didn't seem to do anything when I tried it. Maybe it's not implemented for D3D, or maybe it doesn't do what I think it does. Anyway, when I set my game to render frames as fast as possible, I get 5000 FPS in fullscreen. Almost comical |
Thomas Fjellstrom
Member #476
June 2000
|
Just always update the entire screen. You have more than enough performance with hw acceleration to handle it. There is very little reason to do partial updating these days, and with page flipping being the default in GL and D3D, its impossible to do -- |
|