<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Blending textures</title>
		<link>http://www.allegro.cc/forums/view/588928</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 07 Dec 2006 13:36:34 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I am trying to draw a top down view of the ground in my game world by patching a bunch of tiles next to each other. The thing is that my world is out doors/natural and I don&#39;t like hard edges between my tiles. To solve this I would like to blend the colors from one tile into it&#39;s adjoining tile. </p><p>However the only way I can see to do this with allegro is to pull the RGB color values of a pixel from one tile and average it with the RGB values of another tile. Then making a new color from the averaged RGB values and put it where it belongs. Needless to say this is very slow and unacceptable for the speed I want my ground to scroll.</p><p>Is there anyway, with allegro, to draw a tile with Alpha softened edges? I will need a smooth Alpha transition like in a .tga file or else I would just use magenta .bmp files. I tried RTM but a function name would be most helpfull.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Wilson Saunders)</author>
		<pubDate>Wed, 06 Dec 2006 20:00:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>something like this ?</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/set_alpha_blender" target="_blank"><span class="a">set_alpha_blender</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/draw_trans_sprite" target="_blank"><span class="a">draw_trans_sprite</span></a><span class="k2">(</span> bmp , sprite <span class="k3">-</span><span class="k3">&gt;</span> spr<span class="k2">[</span> frame <span class="k2">]</span> , x <span class="k3">-</span> sprite <span class="k3">-</span><span class="k3">&gt;</span> x , y <span class="k3">-</span> sprite <span class="k3">-</span><span class="k3">&gt;</span> y <span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

The only thing I do not know ( If someone can tell ): </p><p>After a call to set_alpha_blender, can I use several call to draw_trans_sprite or do I need to call it each time before draw_trans_sprite ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Wed, 06 Dec 2006 20:04:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You need to call it only once. Better to pre-calculate the results, though. Allegro&#39;s blenders are really slow.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Fladimir da Gorf)</author>
		<pubDate>Wed, 06 Dec 2006 20:30:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Wilson Saunders, could you tell us if the answer was the one you were waiting for ? </p><p>( Thanks Flad ;-) I only use allegro&#39;s blender as fallback, I tend to use allegrogl instead. )
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Wed, 06 Dec 2006 21:26:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well I will try set_alph_blender() but I will need to know how you load a bmp which has an alpha layer. Also if blending is slow I may have to forgo this entirely. I am needing to do a lot of blends on 64x64 or 128x128 tiles. I guess the real test will be in game performance. I just got off my 10 hour shift at work so I am not going ot impliment this now.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Wilson Saunders)</author>
		<pubDate>Wed, 06 Dec 2006 23:38:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>For a map assuming 16x16 pixels, just make all the tiles 18x18 and make them overlap each other by that 1 extra pixel per side.  Use <tt>draw_trans_sprite()</tt> to put them into their places, and the edges will blend by themselves.</p><p>Oh yea... the game might run a little slow, but that&#39;s alright, right?  <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (TeamTerradactyl)</author>
		<pubDate>Thu, 07 Dec 2006 06:55:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Or draw the tiles so they wrap properly...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (FuriousOrange)</author>
		<pubDate>Thu, 07 Dec 2006 13:36:34 +0000</pubDate>
	</item>
</rss>
