<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Texture mapping with allegro and opengl</title>
		<link>http://www.allegro.cc/forums/view/590060</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 15 Feb 2007 02:46:59 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi,<br />i have mi method for loading a bmp, <br />and this is the code:</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">void</span> CImageLoader::LoadBMP<span class="k2">(</span> <span class="k1">char</span><span class="k3">*</span> strImageName, UINT textureArray<span class="k2">[</span><span class="k2">]</span>, <span class="k1">int</span> textureID <span class="k2">)</span>
<span class="k2">{</span>
  <a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a><span class="k3">*</span> pImageBuffer1<span class="k2">;</span>
  pImageBuffer1 <span class="k3">=</span> <a href="http://www.allegro.cc/manual/load_bmp" target="_blank"><span class="a">load_bmp</span></a><span class="k2">(</span> strImageName, NULL<span class="k2">)</span><span class="k2">;</span>
        glGenTextures<span class="k2">(</span><span class="n">1</span>, <span class="k3">&amp;</span>textureArray<span class="k2">[</span>textureID<span class="k2">]</span><span class="k2">)</span><span class="k2">;</span>
        glBindTexture<span class="k2">(</span>GL_TEXTURE_2D, textureArray<span class="k2">[</span>textureID<span class="k2">]</span><span class="k2">)</span><span class="k2">;</span>
        
gluBuild2DMipmaps<span class="k2">(</span>GL_TEXTURE_2D, <span class="n">3</span>, pImageBuffer1-&gt;w, pImageBuffer1-&gt;h, GL_RGBA, GL_UNSIGNED_BYTE, pImageBuffer1-&gt;dat<span class="k2">)</span><span class="k2">;</span>   <span class="c">// here is the problem</span>

         <a href="http://www.allegro.cc/manual/destroy_bitmap" target="_blank"><span class="a">destroy_bitmap</span></a><span class="k2">(</span> pImageBuffer1 <span class="k2">)</span><span class="k2">;</span>  
<span class="k2">}</span>
</pre></div></div><p>

I did that code in my other computer, and it worked perfectly (amd64), and now, i have to program in my laptop (dell xps, intel core 2 duo), but it doesnt works in my lap!!</p><p>the problem is when i use the gluBuild2Mipmaps.....</p><p>this is the error the debugger throws:<br />First-chance exception at 0x68b27372 in avance1.exe: 0xC0000005: Access violation reading location 0x02ab3000.<br />Unhandled exception at 0x68b27372 in avance1.exe: 0xC0000005: Access violation reading location 0x02ab3000.</p><p>how is it possible that in both computers compile, but in one runs, and in the other doesnt......</p><p>thanks for any possible help
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miguel meza)</author>
		<pubDate>Wed, 14 Feb 2007 08:37:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I notice you&#39;re not testing if load_bmp fails. You should probably also use load_bitmap instead of the format-specific load_bmp.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Wed, 14 Feb 2007 16:15:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Anything wrong with <span class="source-code">GLuint allegro_gl_make_texture_ex <span class="k2">(</span><span class="k1">int</span> flags, <a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a> <span class="k3">*</span>bmp, GLint internal_format<span class="k2">)</span><span class="k2">;</span></span>?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Wed, 14 Feb 2007 16:33:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>As gnolam said you should use allegro_gl_make_texture_ex. IIRC, .dat pointer contains more than just raw pixel data, it had line pointers in it too and that is probably what breaks things.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HoHo)</author>
		<pubDate>Wed, 14 Feb 2007 16:43:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi,<br />Kitty Cat: i checked if the texture was loaded, and it was (i also try with load_bitmap), if i comment:<br /> gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pImageBuffer1-&gt;w, pImageBuffer1-&gt;h, GL_RGBA, GL_UNSIGNED_BYTE, pImageBuffer1-&gt;dat); <br />it doesnt send me and error, but obviously it doesnt maps the texture to the primitive..</p><p>Gnolam:  how do i use the GLuint allegro_gl_make_texture_ex (int flags, BITMAP*	bmp,	GLint internal_format)</p><p>i read the docs, but i&#39;m not sure what should i send in the &quot;GLint internal_format&quot; parameter. can you give me a little example how would it be the complete method?</p><p>HoHo: then why did it worked perfectly in my other computer? i only recompiled it in my lap with the same compiler (vs2005) the code is EXACTLY the same <img src="http://www.allegro.cc/forums/smileys/huh.gif" alt="???" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miguel meza)</author>
		<pubDate>Wed, 14 Feb 2007 21:12:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
then why did it worked perfectly in my other computer?
</p></div></div><p>Probably because I was wrong <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /></p><p>Note to self:<br />next time make sure you know what you are talking about. There is a separate lines[] pointer in BITMAP structure that does what I said <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HoHo)</author>
		<pubDate>Wed, 14 Feb 2007 21:35:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>unless you want to make your own function, look for:</p><p>allegro_gl_make_texture<br />allegro_gl_make_masked_texture
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (vbovio)</author>
		<pubDate>Wed, 14 Feb 2007 21:51:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>well, i can do this....<br />BITMAP* bmp1 = load_bmp( &quot;Bitmap.bmp&quot; , NULL);<br />	allegro_gl_make_texture(bmp1);</p><p>but then... what should i do so the texture mapps with the primitive?<br />and how do i use the GLuint allegro_gl_make_texture_ex (int flags, BITMAP* bmp, GLint internal_format)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miguel meza)</author>
		<pubDate>Thu, 15 Feb 2007 01:03:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>look around for &quot;textured quads&quot;, and spend some time studying opengl.<br />I think one of the examples of allegrogl draws a textured quad..
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (vbovio)</author>
		<pubDate>Thu, 15 Feb 2007 02:46:59 +0000</pubDate>
	</item>
</rss>
