<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>[a5] filtering primitives for offscreen bitmaps?</title>
		<link>http://www.allegro.cc/forums/view/604305</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 10 Jun 2010 04:13:18 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hey again. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /></p><p>When drawing primitives to a bitmap other than the backbuffer, the multisampling fails.  In this example, I&#39;ve drawn a line to the backbuffer (on the left), and also drawn it to an offscreen bitmap (right)</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>ALLEGRO_BITMAP <span class="k3">*</span>offscreen_render<span class="k2">;</span>
<span class="number">  2</span>
<span class="number">  3</span><span class="c">// initialize code</span>
<span class="number">  4</span>
<span class="number">  5</span>offscreen_render <span class="k3">=</span> al_create_bitmap<span class="k2">(</span><span class="n">200</span>, <span class="n">150</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  6</span>
<span class="number">  7</span><span class="c">// in the draw code</span>
<span class="number">  8</span>
<span class="number">  9</span>   al_set_target_bitmap<span class="k2">(</span>offscreen_render<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 10</span>   al_clear_to_color<span class="k2">(</span>color<span class="k2">(</span><span class="s">"light green"</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 11</span>   al_draw_line<span class="k2">(</span><span class="n">10</span>, <span class="n">120</span>, <span class="n">190</span>, <span class="n">100</span>, color<span class="k2">(</span><span class="s">"red"</span><span class="k2">)</span>, <span class="n">3</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 12</span>
<span class="number"> 13</span>   al_set_target_bitmap<span class="k2">(</span>al_get_backbuffer<span class="k2">(</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 14</span>   al_draw_line<span class="k2">(</span><span class="n">10</span>, <span class="n">120</span>, <span class="n">190</span>, <span class="n">100</span>, color<span class="k2">(</span><span class="s">"red"</span><span class="k2">)</span>, <span class="n">3</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 15</span>
<span class="number"> 16</span>   al_draw_bitmap<span class="k2">(</span>offscreen_render, <span class="n">200</span>, NULL<span class="k2">)</span><span class="k2">;</span>
</div></div><p>

Produces:<br /><span class="remote-thumbnail"><span class="json">{"name":"601549","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/4\/d489f234eb978a284c3b80a3ca50963f.png","w":442,"h":217,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/4\/d489f234eb978a284c3b80a3ca50963f"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/d/4/d489f234eb978a284c3b80a3ca50963f-240.jpg" alt="601549" width="240" height="117" /></span></p><p>I tried adding the <span class="source-code">al_set_new_bitmap_flags<span class="k2">(</span>ALLEGRO_VIDEO_BITMAP<span class="k2">)</span></span> before creating the bitmap to be sure, but it didn&#39;t change anything.  My idea for a workaround is to prerender onto the backbuffer and draw from there to intended prerender location.  This doesn&#39;t seem ideal but it could work.  </p><p>[edit] oops, topic should be &quot;[a5] multisampling primitives for offscreen bitmaps?&quot;</p><p>[edit] I&#39;ve tried drawing <i>with</i> the backbuffer to another surface but it won&#39;t permit it.  The console outputs &#39;fail&#39;. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Wed, 09 Jun 2010 07:30:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yes, multi-sampling is only supported on the display backbuffer so far (with OpenGL at least).</p><p>I wouldn&#39;t know how to enable multi-sampling for an FBO. If there&#39;s some simple OpenGL setting for it we should enable it.</p><p>Otherwise, need a patch to implement it.</p><p>Do you know if it works with DirectX?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Wed, 09 Jun 2010 18:46:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><a href="http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_multisample.txt">EXT_framebuffer_multisample</a> looks like it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Milan Mimica)</author>
		<pubDate>Wed, 09 Jun 2010 20:12:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
No method is provided for creating multisample texture images.
</p></div></div><p>

Since we only support drawing into bitmaps (textures) and have no actual &quot;off-screen&quot; buffers, does this mean we cannot use it?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Wed, 09 Jun 2010 20:35:32 +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/604305/869535#target">Elias</a> said:</div><div class="quote"><p>Do you know if it works with DirectX?</p></div></div><p>No.  It does not work with DirectX.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Thu, 10 Jun 2010 04:13:18 +0000</pubDate>
	</item>
</rss>
