Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [A5] Should I bother updating only part of the screen?

This thread is locked; no one can reply to it. rss feed Print
[A5] Should I bother updating only part of the screen?
torhu
Member #2,727
September 2002
avatar

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
Member #8,592
May 2007
avatar

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?

Matthew Leverton
Supreme Loser
January 1999
avatar

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
Member #8,592
May 2007
avatar

torhu
Member #2,727
September 2002
avatar

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 ;D

Thomas Fjellstrom
Member #476
June 2000
avatar

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 ;)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Go to: