Mail Archives: djgpp/1999/02/28/11:31:14
Kevin wrote:
> The following listing just doesn't finish switching and clearing the
> buffers quickly enough, are my conclusions about Allegro correct, or
> am I doing something wrong or missing something really important ?
>
> I wanted to avoid the "dirty rectangle list" route. can I do this with
> Allegro,, or have I to plunge in to the intricacies of Scitechs MGL
> yet again.
Heavily editted down example follows:
> set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0);
> BITMAP *buffer = create_bitmap(640, 480);// Create buffer.
> // Blit the back buffer on to the screen.
> clear(screen);
AAARGH!
> blit(buffer, screen, 0,0, 0,0, 640,480);
> clear(buffer);
> }
> allegro_exit(); // Shutdown the Allegro Graphics Library.
> return 0; // And terminate.
> }
Depends what you mean by 'not fast enough', but one thing first:
You're wasting a HUGE amount of time clearing the screen before blitting
to it. Blitting to the entire screen replaces anything there. (You could
also try to avoid clearing the whole 'buffer' too).
I reckon this method should lead to updates about 30fps. If you aren't
scrolling or changing a large part of the screen, definitely look into
dirty rectangles (lots of examples with allegro and the demo game).
The other way to do it is with page flipping, but I wouldn't recommend
this without using WinAllegro or FreeBE/AF/VBE/AF, but as you said you
wanted VESA2, lets discard that.
Squirting 300K (640*480*8) to the graphics card every frame is a major
bottleneck, best to avoid if poss. You may also want to avoid vsyncing,
and use a timer instead (if you miss an update it will skip 2 updates
with vsync).
Regards,
Robin Burrows.
- Raw text -