<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>[A5] Should I bother updating only part of the screen?</title>
		<link>http://www.allegro.cc/forums/view/606018</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sun, 09 Jan 2011 15:04:22 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve been porting my old A4 game to A5.  The new API is pretty nice, with more consistent and easier to remember names and parameter orders than the old one (maybe except for al_key_down, hehe).</p><p>I don&#39;t know much about how hardware accelerated rendering works, so here goes.  My A4 game used double buffering, and updates only the changed parts of the buffer, before blitting the whole thing to the screen.</p><p>For A5, I just removed the old backbuffer and draw to the default target instead, then call al_flip_display.  This worked in windowed mode (Direct3D), but in fullscreen mode it seems to be using page flipping.  At least it&#39;s doing something that breaks my partial updating scheme.  Which in hindsight is obvious that I would have to expect.</p><p>Should I just update the whole screen every frame?  I suppose I could use a video bitmap for double buffering and keep the partial updating system, but that seems a bit pointless.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Sun, 09 Jan 2011 11:44:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/606018/897773#target">torhu</a> said:</div><div class="quote"><p>
Should I just update the whole screen every frame?  I suppose I could use a video bitmap for double buffering and keep the partial updating system, but that seems a bit pointless.
</p></div></div><p>
I was wondering this myself as I have a gui based on double buffering too. I have some functions that only draw to a specific portion of the screen and if A5 is using page flipping then I could end up with a flickering background image when I run those functions. Should I draw the same background to the back buffer twice (once before flipping, and once afterwards) before running my functions?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sun, 09 Jan 2011 11:52:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If <span class="source-code"><a href="http://www.allegro.cc/manual/al_get_display_option"><span class="a">al_get_display_option</span></a><span class="k2">(</span><span class="k2">)</span></span> returns <span class="source-code">ALLEGRO_UPDATE_DISPLAY_REGION</span>, then you can use <span class="source-code"><a href="http://www.allegro.cc/manual/al_update_display_region"><span class="a">al_update_display_region</span></a><span class="k2">(</span><span class="k2">)</span></span>. Manual says it could be faster.</p><p>But if you use <span class="source-code"><a href="http://www.allegro.cc/manual/al_flip_display"><span class="a">al_flip_display</span></a><span class="k2">(</span><span class="k2">)</span></span>, then I would assume you must completely redraw the entire back buffer if you want to avoid undefined behavior.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Sun, 09 Jan 2011 12:22:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Under <a href="http://www.allegro.cc/manual/5/al_set_new_display_option">al_set_new_display_option</a>, I found the option ALLEGRO_SINGLE_BUFFER. Perhaps this would solve the issue?</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number"> 1</span><a href="http://www.allegro.cc/manual/al_set_new_display_option"><span class="a">al_set_new_display_option</span></a><span class="k2">(</span>ALLEGRO_SINGLE_BUFFER , <span class="n">1</span> , ALLEGRO_REQUIRE<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 2</span>display <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_display"><span class="a">al_create_display</span></a><span class="k2">(</span>width , height<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 3</span><span class="k1">if</span> <span class="k2">(</span><span class="k3">!</span>display<span class="k2">)</span> <span class="k2">{</span><span class="k1">return</span> <span class="n">1</span><span class="k2">;</span><span class="k2">}</span><span class="c">// not supported</span>
</div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sun, 09 Jan 2011 12:51:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>ALLEGRO_SINGLE_BUFFER didn&#39;t seem to do anything when I tried it.  Maybe it&#39;s not implemented for D3D, or maybe it doesn&#39;t do what I think it does.  Anyway, when I set my game to render frames as fast as possible, I get 5000 FPS in fullscreen.  Almost comical <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (torhu)</author>
		<pubDate>Sun, 09 Jan 2011 13:13:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Just always update the entire screen. You have more than enough performance with hw acceleration to handle it. There is very little reason to do partial updating these days, and with page flipping being the default in GL and D3D, its impossible to do <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 09 Jan 2011 15:04:22 +0000</pubDate>
	</item>
</rss>
