[A5] Should I bother updating only part of the screen?
torhu

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

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

Under al_set_new_display_option, I found the option ALLEGRO_SINGLE_BUFFER. Perhaps this would solve the issue?

#SelectExpand
1al_set_new_display_option(ALLEGRO_SINGLE_BUFFER , 1 , ALLEGRO_REQUIRE); 2display = al_create_display(width , height); 3if (!display) {return 1;}// not supported

torhu

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

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

Thread #606018. Printed from Allegro.cc