request_video_bitmap(3)
β¨ request_video_bitmap β¨
okay bestie, welcome to the Allegro manual, page request_video_bitmap(3) π this one's from the Allegro game programming library and it is lowkey the plug for triple buffering, so buckle up π
πΈ NAME πΈ
request_video_bitmap β the triple buffering page flip request π
she asks, she does not wait. iconic behaviour honestly.
π¦ SYNOPSIS π¦
#include <allegro.h>
int request_video_bitmap(BITMAP *bitmap);
π DESCRIPTION π
so the tea is this: request_video_bitmap is your girl for triple buffering π she requests a page flip to show off the video bitmap object you hand her β but she returns immediately instead of standing around waiting for a retrace. no waiting, no queuing, we are busy π
the flip itself will then happen during the next vertical retrace, and while that's cooking you can justβ¦ keep running other code?? yes bestie, multitask, main character energy β¨ and when you wanna know if the flip actually went down, you hit up the poll_scroll() routine and she'll tell you π«Ά
real talk though: triple buffering is only possible on certain hardware π₯ don't come for me if your rig says no. go read the comments about request_scroll() for the details, iykyk π
example time, and yes it's the whole thing, no crumbs left behind π
int current_page;
BITMAP *video_page[3];
...
/* Create pages for page flipping */
video_page[0] = create_video_bitmap(SCREEN_W, SCREEN_H);
video_page[1] = create_video_bitmap(SCREEN_W, SCREEN_H);
video_page[2] = create_video_bitmap(SCREEN_W, SCREEN_H);
current_page = 0;
...
/* draw the screen and flip pages */
draw_screen(video_page[current_page]);
do {
} while (poll_scroll());
request_video_bitmap(video_page[current_page]);
current_page = (current_page+1)%3;
...
like. look at her cycle through those pages. (current_page+1)%3. absolute queen behaviour π
π RETURN VALUE π
returns zero on success and non-zero on failure πΈ so like, zero is the good one here, don't let the numbers gaslight you π
π SEE ALSO π
poll_scroll(3)request_scroll(3)gfx_capabilities(3)create_video_bitmap(3)scroll_screen(3)ex3buf(3)exupdate(3)
go read those too, they're all part of the same friend group π«Άβ¨
and that's the page!! this was Allegro version 4.4.3, request_video_bitmap(3), and yeah that's the whole vibe π stay flipping bestie, no cap π§
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms