delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/26/19:09:25

From: tangchis AT iscs DOT nus DOT sg ([Uzi Suicide])
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Which is faster? Allegro or Sandmann's LFB
Date: 26 Dec 1996 23:12:32 GMT
Organization: The Electric WatchTower
Lines: 57
Message-ID: <59v0p0$g3j@nuscc.nus.sg>
References: <59s2q3$84l AT nuscc DOT nus DOT sg> <19961226 DOT 230751 DOT 4975 DOT 3 DOT chambersb AT juno DOT com>
NNTP-Posting-Host: tangchis AT decunx DOT iscs DOT nus DOT sg
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Benjamin D Chambers (chambersb AT juno DOT com) wrote:

: I've seen a program get over 200fps with Allegro on a Pentium-133. (Clear
: the buffer, draw on buffer, copy to video).  Was just a test, but it
: worked :)

Well .. I've just downloaded Allegro and got it to compile. I also ported
my program to use Allegro instead of my own VBE 2.0 lib. 

Basically, the program is :

---

  InitGraphics();  // init graphics system
  
  DBCreate();      // create a double buffer in ram

  // do for 480 frames, ie when line from top moves to bottom
  for (i=0,col=0; i<480; i++)
  {
    // throw 640x480 pixels into the dbuffer each frame
    // -> simulates a really bad case of rendering
    for (y=0; y<480; y++)
    for (x=0; x<640; x++) DBPutPixel(x,y,col=(col+1)%256);

    // draw 2 lines in dbuffer
    // 1 line moves down, the other moves across
    DBDrawLine(0,i,640,i,100);
    DBDrawLine(i,0,i,480,100);

    // blast dbuffer to video
    DBCopyToVideo();

    // clear dbuffer to 0
    DBClear(0);
  }

  // free the dbuffer
  DBFree();

  // shut down
  CloseGraphics();

---

I ported this to Allegro, using BITMAP *dbuffer, and putpixel to this
dbuffer, etc.

The result I got was 17fps using my own vbe 2.0 lib, and 7fps using
Allegro.

I calculated this frame rate by dividing 480 (since I threw this many
frames in the program) by the time in seconds it took to execute the own
thing. 

Looks like I'll be keeping my vbe lib around for a while ... :)

- Raw text -


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