Archived

This topic is now archived and is closed to further replies.

allegro and page flippin/double buffering

This topic is 5274 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m trying to implement a page flipping system using allegro. Right now, all my program needs to do is clear the screen, draw a pic at a specified point, and then display. Here''s my code: BEGIN_DRAW // locks video memory clear_bitmap(screen); draw_sprite(back_buffer, chick[0], dx, dy); show_video_bitmap(back_buffer); END_DRAW // unlocks it And it works, but it doesn''t eliminate the page flicker that its supposed to. I''ve tried double buffering as well and used vsync(), but I still get these horizontal lines that flash through the pic as its moving across the screen. Any help and/or criticism of my technique would be greatly appreciated. Jeremy

Share this post


Link to post
Share on other sites
http://www.allegro.cc/manual/view_function.php?_id=1162&request=1057473375&

http://www.allegro.cc/manual/view_category.php?_id=8&request=1057473253&

Share this post


Link to post
Share on other sites
hmm, haven;t used allegro in ages (don''t knoe what BEGIN_DRAW does) but i would guess the flicker is cause by clear_bitmap(screen) insomuchas that clears the screen buffer whilst it is visible. you don''t need to clear it cos it will be replaced by the back_buffer when you call show_video_bitmap. if anything that should be clear_bitmap(back_buffer);

Share this post


Link to post
Share on other sites
There are several types of "flicker". The kind you are seeing is indeed caused by clearing the screen before replacing it with the back buffer. Vsync flicker can be eliminated by waiting for the vertical retrace sync (i''m pretty sure allegro has a waitForVsync() type function, but I haven''t used it in awhile), but this can slow down your program a bit, depending on the refresh rate.

Triple buffering is the best way to eliminate flicker, but can be expensive in terms of memory for high resolutions.

Share this post


Link to post
Share on other sites