<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>16bpp and triple buffering</title>
		<link>http://www.allegro.cc/forums/view/558370</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 10 Jan 2006 20:54:16 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Does 16bpp support triple buffering? </p><p>It runs fine, but when I esc to close out, i get a runtime error window. But when I run it as 32bpp, it closes fine.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kevin Epps)</author>
		<pubDate>Mon, 09 Jan 2006 03:58:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Are you doing all the right things, like destroying any sub-bitmaps before destroying the main video pages and not (as the mistake I made) calling set_gfx_mode() before deleting the main video pages.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Walker)</author>
		<pubDate>Mon, 09 Jan 2006 04:48:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yes, that&#39;s how I have it now.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kevin Epps)</author>
		<pubDate>Mon, 09 Jan 2006 05:27:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Your video card is free to support triple buffering for certain modes only. Modern cards are probably optimized for 32bpp, so they might just not bother implementing triple buffering for other color depths in the driver.<br />Also, keep in mind that windows reports both 15 and 16 bpp as 16, so the only way to find out is check.<br />In windowed mode, it is possible that triple buffering only works in the desktop color depth.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tobias Dammers)</author>
		<pubDate>Tue, 10 Jan 2006 15:57:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>As far as I know, there is nothing special about triple buffering that some cards support and others don&#39;t. It is just page flipping with three pages in the flip chain. If your card supports any kind of page flipping in that mode and has enough memory for another page, then &quot;triple buffering&quot; shouldn&#39;t be a problem.</p><p>On a side note, don&#39;t use triple buffering just because you heard it was smooth. It has a chance of smoothing things out only if your rendering times are variable, below and above refresh times. Each page added to the flip chain adds a frame of visual latency and increases the <i>chance</i> of smoothness.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve++)</author>
		<pubDate>Tue, 10 Jan 2006 20:40:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
It is just page flipping with three pages in the flip chain. If your card supports any kind of page flipping in that mode and has enough memory for another page, then &quot;triple buffering&quot; shouldn&#39;t be a problem.
</p></div></div><p>
Not quite, actually.<br />In addition to being able to pageflip, you need to be able to tell the hardware (driver, whatever) to flip at the next sync. That&#39;s why the triple buffering update method looks like
</p><div class="source-code snippet"><div class="inner"><pre>   <span class="c">/* draw screen */</span>
   draw_scene<span class="k2">(</span>page<span class="k2">[</span>num<span class="k2">]</span><span class="k2">)</span><span class="k2">;</span>
   <span class="c">/* Make sure last flip was done */</span>
   <span class="k1">while</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/poll_scroll" target="_blank"><span class="a">poll_scroll</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">)</span> <span class="k2">{</span> <a href="http://www.allegro.cc/manual/rest" target="_blank"><span class="a">rest</span></a><span class="k2">(</span><span class="n">1</span><span class="k2">)</span><span class="k2">;</span> <span class="c">/* or not...*/</span> <span class="k2">}</span><span class="k2">;</span>
   <span class="c">/* tell hardware to display new page at the next sync */</span>
   <a href="http://www.allegro.cc/manual/request_video_bitmap" target="_blank"><span class="a">request_video_bitmap</span></a><span class="k2">(</span>page<span class="k2">[</span>num<span class="k2">]</span><span class="k2">)</span><span class="k2">;</span>
   <span class="c">/* Advance to next drawing page */</span>
   num <span class="k3">=</span> <span class="k2">(</span>num<span class="k3">+</span><span class="n">1</span><span class="k2">)</span>%<span class="n">3</span><span class="k2">;</span>
</pre></div></div><p>
Whereas double buffering looks like
</p><div class="source-code snippet"><div class="inner"><pre>   <span class="c">/* draw screen */</span>
   draw_scene<span class="k2">(</span>page<span class="k2">[</span>num<span class="k2">]</span><span class="k2">)</span><span class="k2">;</span>
   <span class="c">/* tell hardware to display new page right now */</span>
   <a href="http://www.allegro.cc/manual/show_video_bitmap" target="_blank"><span class="a">show_video_bitmap</span></a><span class="k2">(</span>page<span class="k2">[</span>num<span class="k2">]</span><span class="k2">)</span><span class="k2">;</span>
   <span class="c">/* Advance to next drawing page */</span>
   num <span class="k3">=</span> <span class="k2">(</span>num<span class="k3">+</span><span class="n">1</span><span class="k2">)</span>%<span class="n">2</span><span class="k2">;</span>
</pre></div></div><p>

A card may be able to do pageflipping but not triple buffering if you cannot request a pageflip at the next sync.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Tue, 10 Jan 2006 20:54:16 +0000</pubDate>
	</item>
</rss>
