<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Problems porting to linux. Video crashes </title>
		<link>http://www.allegro.cc/forums/view/618495</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 04 Sep 2021 20:24:04 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well, i tried to port my Allegro 5 app to linux and blum!! locked bitmaps pointers doesn&#39;t work.<br />Anyway they give me a negative pitch (stride). <br />And how do i put pixels to a 256*256 surface not using al_putpixel() which is slow?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Lucas Dalmasso)</author>
		<pubDate>Thu, 02 Sep 2021 05:35:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You want al_put_pixel((int x, int y, ALLEGRO_COLOR color), not the al_putpixel() which is from allegro 4.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Thu, 02 Sep 2021 15:01:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Sorry i meant al_put_pixel(). The one in current Allegro 5. <br />I want to put the pixels locking and writing to the pointer, but it seems there is a problem in  linux with that pointer.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Lucas Dalmasso)</author>
		<pubDate>Thu, 02 Sep 2021 15:19:08 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>There&#39;s nothing wrong with the pointer. Pitch may be negative. You have to account for that.</p><p>Read over <a href="https://liballeg.org/a5docs/trunk/graphics.html#al_lock_bitmap">al_lock_bitmap</a> and <a href="https://liballeg.org/a5docs/trunk/graphics.html#allegro_locked_region">ALLEGRO_LOCKED_REGION</a>.</p><p>The formula for pixel x,y is :
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/ALLEGRO_BITMAP"><span class="a">ALLEGRO_BITMAP</span></a><span class="k3">*</span> bmp <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_create_bitmap"><span class="a">al_create_bitmap</span></a><span class="k2">(</span><span class="n">480</span>,<span class="n">360</span><span class="k2">)</span><span class="k2">;</span>
<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_LOCK_READWRITE , ALLEGRO_PIXEL_FORMAT_RGBA<span class="k2">)</span><span class="k2">;</span>

<span class="k1">char</span><span class="k3">*</span> byte <span class="k3">=</span> lock-&gt;data <span class="k3">+</span> y<span class="k3">*</span>lock-&gt;pitch <span class="k3">+</span> <span class="n">4</span><span class="k3">*</span>x <span class="k3">+</span> <span class="c">/*0,1,2,3*/</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 (Edgar Reynaldo)</author>
		<pubDate>Thu, 02 Sep 2021 20:09:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, i have to fill all the screen starting from pixdel 0 to last pixel, so for the sake of doing it faster i only advance the pointer. Im not using X and Y coordinates (that&#39;s s why i wanted to do it that way), but it seems i cannot with a negative pitch.<br />When the same code runs in linux the system crashes and im using 256 width surface whichh is 256 * 4 = 1024 byes exactly of pitch.<br />It seems, indeed that OpenGL behaves differently than Direct3D in that matter.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Lucas Dalmasso)</author>
		<pubDate>Thu, 02 Sep 2021 21:09:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>A multiply and an addition won&#39;t be significantly slower than just an increment, but it will be correct. And besides, that&#39;s the only correct way to do it.</p><p><b>EDIT</b><br />To be fair, you only need to reset the byte pointer when the line changes. You can still use increment along each line as you were before.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sat, 04 Sep 2021 20:24:04 +0000</pubDate>
	</item>
</rss>
