alufers
alufers

Reputation: 134

Why is allegro c++ clearing the screen with blue color?

I am using the following code, which should clear the screen with black color, but it is blue.

#define ALLEGRO_STATICLINK
#include <allegro5/allegro.h>

int main()
{
 al_init();
 ALLEGRO_DISPLAY* display = al_create_display(800, 600);
 al_clear_to_color(al_map_rgb(0, 0, 0));
 al_flip_display();
 al_rest(5.0);
 return 0;
}

enter image description here

Upvotes: 0

Views: 1642

Answers (1)

rcorre
rcorre

Reputation: 7218

Try flipping, then waiting a bit before flipping again:

ALLEGRO_DISPLAY *display = al_create_display(800,600);

al_flip_display();
al_rest(0.1);

al_clear_to_color(al_map_rgb(0,0,0));
al_flip_display();

al_rest(2.0);

Ordinarily you'd be clearing the screen in an update-draw loop, so you wouldn't see this sort of thing, but it can occur if you're just trying to clear and flip it once (I believe it may have to do with double-buffering, but don't quote me on that).

Upvotes: 2

Related Questions