delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/30/07:16:13

Newsgroups: comp.os.msdos.djgpp
From: Elliott Oti <e DOT oti AT stud DOT warande DOT ruu DOT nl>
Subject: Re: Clipping or Double Buffering : Which one should I use? (Allegro)
Sender: usenet AT fys DOT ruu DOT nl (News system Tijgertje)
Message-ID: <3456D289.38@stud.warande.ruu.nl>
Date: Wed, 29 Oct 1997 06:07:05 GMT
References: <632ddv$o5m$1 AT news DOT interlog DOT com>
Mime-Version: 1.0
Organization: Bipolar Widgets International
Lines: 54
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Gautam N. Lad wrote:
> 
> Hi,
> I have a question.  I'm writing a farily big program, and I need to know if I should
> use double buffering or clipping?
> 
> I draw (mainly polys) to a double buffer, and then blit it to the screen.  Is there a
> speed difference between the two?
> 
> It doesn't really make much of a difference which one I use, but I need to know
> which one is faster.
> 
> Right now, it takes my program to draw 8100 3D rectangles (in 4 views of size
> 240x180) about 4 seconds.  The polys drawn are not of the same view.
> This is using double buffering.  I haven't tried clipping, but should I?
> 
> My computer is 486 DX2 50MHz, w/ 32MB RAM (running on a DriveSpaced
> drive w/ 20MB free).

Double buffering means drawing everything onto an offscreen buffer and
blitting it onto the screen. I take it clipping == page-flipping. In
VESA or ModeX flipping means drawing onto offscreen video memory and
flipping the display start to that part of vid memory, then using the
first part of vid memory as the new drawing buffer.

On practically all computers I've seen (except maybe 486 SX's with
vintage VGA) double-buffering is faster than page-flipping up to
resolutions of at least 800x600. 
On my venerable old Trident 9440 a 320x200 screen can be blitted through
at 120 fps. On a Diamond Stealth this goes at 400 fps. Blitting large
chunks to a PCI card puts it in burst-mode, and that results in a speed
increase, especially compared to filling it byte-for-byte. That more
than compensates for the fact that in double-buffering a pixel is
written twice: once to the memory buffer and once to the screen buffer.

Only when the overhead of blitting begins to overshadow the gains of
burst-mode blitting is page-flipping a viable alternative: on my revered
Trident the break-even point lies at around 800x600. By then it's
crawling at 20 fps max, which means in practice that I don't run
applications in 800x600 with it.

In all: especially if you clear your rendering buffers to 0 before
drawing, I would stick to double buffering.

PS: this is a shameless plug for a 3d engine I'm not supporting anymore,
and plan to supercede, but if you're looking for a 3D renderer that can
work with Allegro, and you can read c++, try
http://www.fys.ruu.nl/~oti/prog.html and check Tpoly II. On a fast 486
it draws between 10,000 and 20,000 smallish gouraud-shaded polys per
second.  

-- 
------------ Elliott Oti ---------------
   ------------- http://www.fys.ruu.nl/~oti  ---------

- Raw text -


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