<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>The most effective use of al_hold_bitmap_drawing</title>
		<link>http://www.allegro.cc/forums/view/617314</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 15 Mar 2018 02:07:56 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi,</p><p>I know there are already some thread with this topic, but none of the answers were quite exhaustive.</p><p>What is most effective usage of the <span class="source-code"><a href="http://www.allegro.cc/manual/al_hold_bitmap_drawing"><span class="a">al_hold_bitmap_drawing</span></a><span class="k2">(</span><span class="k1">true</span><span class="k2">)</span></span>? I am not sure if I understand the documentation correctly. </p><p>Specifically, do I have to to call <span class="source-code"><a href="http://www.allegro.cc/manual/al_hold_bitmap_drawing"><span class="a">al_hold_bitmap_drawing</span></a><span class="k2">(</span><span class="k1">false</span><span class="k2">)</span></span> every time the actually rendered bitmap (parent bitmap) changed from the last rendered or is it not neccessary? And if the second option is correct, is it simply enough to call <span class="source-code"><a href="http://www.allegro.cc/manual/al_hold_bitmap_drawing"><span class="a">al_hold_bitmap_drawing</span></a><span class="k2">(</span><span class="k1">true</span><span class="k2">)</span></span> before the first bitmap and then call <span class="source-code"><a href="http://www.allegro.cc/manual/al_hold_bitmap_drawing"><span class="a">al_hold_bitmap_drawing</span></a><span class="k2">(</span><span class="k1">false</span><span class="k2">)</span></span> just before the flip?</p><p>Thank you for answer.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Karolx)</author>
		<pubDate>Tue, 13 Mar 2018 02:50:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><a href="http://liballeg.org/a5docs/trunk/graphics.html#al_hold_bitmap_drawing">http://liballeg.org/a5docs/trunk/graphics.html#al_hold_bitmap_drawing</a></p><p>The main problem is changing the texture that is bound in the gpu. If you have to bind a different texture to draw the next object it takes longer, thus the fewer times you bind a new texture to draw the better. This is why tile or sprite atlases are used, because they keep all the related graphics on the same gpu texture.</p><p>You can draw whatever you want while drawing is held, but only drawing from the same few textures will get you a speed advantage when you release held drawing.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Tue, 13 Mar 2018 20:00:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I understand why we want to hold textures and why it is best to have as few textures as possible (or parent textures) and draw them with minimal switching between them.</p><p>My question is about the api. Do I have to do something when switching textures or it is possible to call <span class="source-code"><a href="http://www.allegro.cc/manual/al_hold_bitmap_drawing"><span class="a">al_hold_bitmap_drawing</span></a><span class="k2">(</span><span class="k1">true</span><span class="k2">)</span></span> before the first bitmap and then call <span class="source-code"><a href="http://www.allegro.cc/manual/al_hold_bitmap_drawing"><span class="a">al_hold_bitmap_drawing</span></a><span class="k2">(</span><span class="k1">false</span><span class="k2">)</span></span> just before the flip?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Karolx)</author>
		<pubDate>Thu, 15 Mar 2018 01:49:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I mostly answered that. Allegro will handle texture changes, but every time the texture is changed it must flush its cache of operations, which defeats the point of using held drawing.</p><p>So, you only need one pair of hold drawing calls. Allegro will take care of the rest.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 15 Mar 2018 01:51:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thank you for answer(s). I know you mostly answered that, but I wanted an explicit answer to be sure. So thanks for that.</p><p>Maybe one little additional question. If Allegro can handle texture changes, is there any advantage of not using <span class="source-code"><a href="http://www.allegro.cc/manual/al_hold_bitmap_drawing"><span class="a">al_hold_bitmap_drawing</span></a></span>?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Karolx)</author>
		<pubDate>Thu, 15 Mar 2018 02:07:56 +0000</pubDate>
	</item>
</rss>
