<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>acquire/release_bitmap: Is this valid?</title>
		<link>http://www.allegro.cc/forums/view/590056</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 14 Feb 2007 21:25:08 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code snippet"><div class="inner"><pre>...
<span class="k1">while</span><span class="k2">(</span><span class="n">1</span><span class="k2">)</span>
<span class="k2">{</span>
  <a href="http://www.allegro.cc/manual/acquire_screen" target="_blank"><span class="a">acquire_screen</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
  ... <span class="c">//Do drawing stuff here</span>
  <a href="http://www.allegro.cc/manual/release_screen" target="_blank"><span class="a">release_screen</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
...
</pre></div></div><p>

I was thinking that there has to be more efficient ways of drawing than backbuffers or double buffering- is this little code snippet valid?  According to the documentation, acquire_screen can mess things up if you don&#39;t use it correctly.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spork222)</author>
		<pubDate>Wed, 14 Feb 2007 04:24:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Sure you can draw a bunch of stuff directly to the screen if you don&#39;t mind artifacts, shearing, and just a horrible all around experience.</p><p>When you use those functions the only thing between them must be drawing operations <i>to</i> the bitmap you&#39;ve locked.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Wed, 14 Feb 2007 04:26:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Wow, that was fast.</p><p>That&#39;s what I meant.  What I wanted to do was instead of drawing stuff to a backbuffer and then blitting it to the screen, to lock the screen and draw to it directly, then clear it at the beginning of the cycle.  Is that any more efficient than a backbuffer?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spork222)</author>
		<pubDate>Wed, 14 Feb 2007 04:29:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Unless you are drawing very little then no. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /> Any form of scrolling will look bad without some form of double buffer or page flipping.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 14 Feb 2007 04:31:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>By removing the buffering step, you are effectively removing the guarantee that the screen itself will only update when you tell it to. Otherwise, the screen could update at any moment, rendering only as much (or as little) as is currently on the screen bitmap surface.</p><p>Double Buffer or Page Flipping is almost a necessity...</p><p>...however, there&#39;s another update method called &quot;Dirty Rectangles&quot; where you only update areas that have changed. I personally don&#39;t recommend it, but if framerate is a huge issue and you&#39;re not doing full-screen scrolling, it will deliver, but it will also be the poorest quality refreshing you could hope to achieve, and more complicated to implement.</p><p>--- Kris Asick (Gemini)<br />--- <a href="http://www.pixelships.com">http://www.pixelships.com</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kris Asick)</author>
		<pubDate>Wed, 14 Feb 2007 14:07:42 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If what your looking for is a quick way to draw to the screen then you should use a double buffer.</p><p>BITMAP*dbuffer;<br /><i>*initialize things and do all your coding here*</i><br /><i>*then when you draw just draw to the buffer*</i></p><p>dbuffer=create_bitmap(SCREEN_W,SCREEN_H);<br /><i>*dont forget to create the buffer*</i><br />draw_sprite(dbuffer,sprite*,int x, inty);<br />blit(dbuffer...<br />textprintf(dbuffer...</p><p><i>*once all that is done you can call the screen draw function*</i></p><p>acquire_screen();<br />   blit(dbuffer,screen,0,0,0,0,SCREEN_W,SCREEN_H);<br />release_screen();</p><p>It really simplifies your screen drawing code, as you can see it&#39;s only three lines.  I find this to be the easiest and most efficient form for rendering.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Taiko Keiji)</author>
		<pubDate>Wed, 14 Feb 2007 20:28:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
most efficient form for rendering.
</p></div></div><p>That would be <i>triple</i> buffering...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kauhiz)</author>
		<pubDate>Wed, 14 Feb 2007 21:25:08 +0000</pubDate>
	</item>
</rss>
