|
[4.9.12] Making a screenshot |
Michael Faerber
Member #4,800
July 2004
|
Hi! In SpeedHack I tried to save a screenshot of the screen (after having drawn to it), but I failed - it seemed that only white got saved to my temporary bitmap. The following code was used to test if my method of grabbing the screen was correct. It should basically draw the current screen image to a bitmap and then draw it back on the screen. However, the screen was all white afterwards. ALLEGRO_BITMAP *scrshot = al_create_bitmap(800, 600); al_set_target_bitmap(scrshot); al_clear_to_color(al_map_rgb_f(0, 0, 0)); al_draw_bitmap(al_get_backbuffer(), 0, 0, 0); al_set_target_bitmap(al_get_backbuffer()); al_draw_bitmap(scrshot, 0, 0, 0); Does anybody know what's going on here? -- |
Matthew Leverton
Supreme Loser
January 1999
|
I just tested on Windows. Direct 3D
OpenGL
(Each of the above was passed directly to al_save_bitmap().) Accessing the front buffer isn't guaranteed to work at all, so no surprises there. |
Milan Mimica
Member #3,877
September 2003
|
Keep in mind backbuffer is undefined after al_flip_display().
-- |
|