<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>open GL + al_draw_indexed_prim</title>
		<link>http://www.allegro.cc/forums/view/615834</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sun, 25 Oct 2015 01:50:27 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I have been working on bringing spine animations into my game, however, having just spent a week getting it all working, when I merged it into my game I&#39;ve hit a serious problem.</p><p>It draws the graphics using al_draw_indexed_prim, which it seems needs ALLEGRO_OPENGL as a display flag. which if I set that it works fine, however, when I use ALLEGRO_OPENGL as a display flag it causes my graphics loader to crash.</p><p>	ALLEGRO_LOCKED_REGION* lock = al_lock_bitmap(bmp,ALLEGRO_PIXEL_FORMAT_RGBA_8888 , ALLEGRO_LOCK_WRITEONLY); <br />	memcpy(lock-&gt;data,Buffer,(4*Width)*Height);<br />	al_unlock_bitmap(bmp); </p><p> So im between a rock and a hard place here, al_draw_indexed_prim does not work if openGl is not used, but if I use OpenGL, something happens to the memcopy function that causes a crash.</p><p>Is there another al_draw_indexed_prim that will work without GL.<br />Or does anyone know why the memcopy is crashing? (works 100% without openGL).</p><p>As a side note, when I set al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); it all worked OK, but was 1000X slower. <img src="http://www.allegro.cc/forums/smileys/huh.gif" alt="???" />?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (duncan perham)</author>
		<pubDate>Sun, 25 Oct 2015 00:39:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You need to use lock-&gt;pitch (which is usually negative with OpenGL). So something like:
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/ALLEGRO_LOCKED_REGION"><span class="a">ALLEGRO_LOCKED_REGION</span></a><span class="k3">*</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_539.html" target="_blank">lock</a> <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_lock_bitmap"><span class="a">al_lock_bitmap</span></a><span class="k2">(</span>bmp,ALLEGRO_PIXEL_FORMAT_RGBA_8888 , ALLEGRO_LOCK_WRITEONLY<span class="k2">)</span><span class="k2">;</span>
<span class="k1">for</span> <span class="k2">(</span><span class="k1">int</span> i <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span> i <span class="k3">&lt;</span> Height<span class="k2">;</span> i<span class="k3">+</span><span class="k3">+</span><span class="k2">)</span> <span class="k2">{</span>
    <a href="http://www.delorie.com/djgpp/doc/libc/libc_566.html" target="_blank">memcpy</a><span class="k2">(</span><span class="k2">(</span><span class="k1">uint8_t</span><span class="k2">)</span>lock-&gt;data <span class="k3">+</span> i <span class="k3">*</span> lock-&gt;pitch, Buffer <span class="k3">+</span> i <span class="k3">*</span> <span class="n">4</span> <span class="k3">*</span> Width, <span class="n">4</span><span class="k3">*</span>Width<span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
<a href="http://www.allegro.cc/manual/al_unlock_bitmap"><span class="a">al_unlock_bitmap</span></a><span class="k2">(</span>bmp<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Sun, 25 Oct 2015 00:53:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks a million, that all works well together now <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (duncan perham)</author>
		<pubDate>Sun, 25 Oct 2015 01:50:27 +0000</pubDate>
	</item>
</rss>
