www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/28/11:31:14

From: Robin Burrows <rburrows AT bigfoot DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Is Allegro too slow for 648 * 480 double buffering ?
Date: Sun, 28 Feb 1999 16:06:15 +0000
Organization: Virgin News Service
Lines: 44
Message-ID: <36D96977.4B27@bigfoot.com>
References: <36d9629e DOT 17499764 AT 158 DOT 152 DOT 254 DOT 68>
NNTP-Posting-Host: 194.168.235.114
Mime-Version: 1.0
X-Mailer: Mozilla 3.01C-VN711-003 (Win95; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019