request_video_bitmap(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

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

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