Article View: rec.games.programmer
Article #1572Re: Triple Buffering: Maybe..
From: Christopher Phillips
Date: Fri, 25 Dec 1992 15:18
Date: Fri, 25 Dec 1992 15:18
48 lines
2702 bytes
2702 bytes
vanderby@mprgate.mpr.ca (David Vanderbyl) writes:
>I do see the point. But what are you going to do with about 25 frames
>when the frame rate is 30? I don't think showing 25 frames with some
>repeats will be much better animation than showing 15 frames with all
>repeats.
It's precisly this situation where triple buffering is the most
effective; As long as your underlying model maintains a constant speed
(see other articls in this thread), more frames always looks better,
particularly when we are talking about a 5:3 improvement such as the one
mentioned above.
>Of course, we are assuming that the redraw rate is just longer than the
>frame rate. Of course if the redraw rate was a lot longer then triple
>buffering could improve things. An example would be if we could increase
>from 4 to 5 redraws per second.
Triple buffering will never get your this sort of improvement from a
crt; it will save you a maximum of one refresh period per frame. When
you are talking about 4 redraws per second, you go at most 1% faster by
triple buffering. In other words, you have a complete waste of memory.
While on the topic of avoiding 'wasting cpu time on frame waits', it is
worth remembering that, for many applications, the refresh code does not
always start writing to the frame-buffer immediately. For example, a 3d
graphics game has to convert vertices to screen coordinates, initialise
scan routines etc. This can all be done while waiting for the refresh.
If your preparatory routines for each frame take more than a single
refresh period, you will not benefit at all from triple buffering.
The following is pseudo-code for my main loop:
{
scribble on off-screen page
tell interupt routine 'next page is ready'
prepare to draw next frame
if frame has not been flipped yet, then wait for flip
}
where there is an interupt routine that is called at every fly-back, and
swaps the on and off screen pages when the next page is ready, and
indicates that the swap has occured.
Merry Christmas all!
Christoper Jam
Technical Details
Message-ID:
<1hf8n9INN8c3@uniwa.uwa.edu.au>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!uniwa!shrydarReferences:
<1992Dec21.171731.26731@midway.uchicago.edu> <1992Dec22.202057.18233@blkbox> <709@muller.loria.fr> <1992Dec24.185505.27786@mprgate.mpr.ca> <1992Dec24.152230@betsy.gsfc.nasa.gov> <1992Dec24.223839.29198@mprgate.mpr.ca>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!uniwa!shrydar From: shrydar@tartarus.uwa.edu.au (Christopher Phillips) Newsgroups: rec.games.programmer Subject: Re: Triple Buffering: Maybe.. Date: 25 Dec 1992 15:18:01 GMT Organization: The University of Western Australia Lines: 49 Message-ID: <1hf8n9INN8c3@uniwa.uwa.edu.au> References: <1992Dec21.171731.26731@midway.uchicago.edu> <1992Dec22.202057.18233@blkbox> <709@muller.loria.fr> <1992Dec24.185505.27786@mprgate.mpr.ca> <1992Dec24.152230@betsy.gsfc.nasa.gov> <1992Dec24.223839.29198@mprgate.mpr.ca> NNTP-Posting-Host: tartarus.uwa.edu.au Keywords: buffering