<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Back On The Object Loader Again</title>
		<link>http://www.allegro.cc/forums/view/618338</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 13 Jan 2021 19:54:32 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi all:</p><p>  I had some time to waste so I thought I would try getting an</p><p>object loader to work again. I found Nate Robins object loader</p><p>library so I thought I would give it a try. Had some real good</p><p>luck except for one small detail. I can load and render every</p><p>model if it contains just the .obj and .mtl files. If they contain</p><p>the texture file I fall short. The library contains code to load</p><p>the texture but I can&#39;t get them to load and render, Every time</p><p>I get the message: Unable to load texture. The texture is there</p><p>it just want load for some reason. I was wondering if anyone had</p><p>any experience with this library, maybe they might know how to fix</p><p>this problem.</p><p>Thanks for your time
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Scooter)</author>
		<pubDate>Tue, 12 Jan 2021 01:51:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>do you have the directory information correct? What are you using to load the texture?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (DanielH)</author>
		<pubDate>Tue, 12 Jan 2021 02:40:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi Daniel:</p><p>   Thanks for the reply!</p><p>Embedded in the library is a function called glmLoadTexture(). This</p><p>function looks for jpg, png or PPM files for the texture. At one</p><p>point I had it to load a PPM file but it did not load right. There</p><p>is some mention of using SOIL to load textures but it didn&#39;t work </p><p>either. All I am getting is just the .mtl file with no texture. I</p><p>now have 4 different files and they all do the same thing: no textures.</p><p>The reason I have 4 different ones is other people have made improvements</p><p>to this library so I tried all of them but I guess they didn&#39;t work in</p><p>this area. It is a great library using just straight C. This is what</p><p>I prefer to work with. Again, thanks for the reply. If you come up</p><p>with something, please let me know. Have a great day!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Scooter)</author>
		<pubDate>Tue, 12 Jan 2021 03:14:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think you need to provide more details before we can help you. Can you share a minimal project (sources + data files) that demonstrates the problem? </p><p>Also, why do you format your posts like a poem? <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (amarillion)</author>
		<pubDate>Tue, 12 Jan 2021 14:21:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;d imagine there&#39;s going to be some Allegro specific bits you&#39;ll need to modify (if you&#39;re using Allegro). Even with glut there&#39;s probably some code you need to add.</p><p>You&#39;ll need to ensure that the texture described in the mtl file is being put where it should be for the texture loader to work, ans also ensure it&#39;s being properly mapped to the object. I&#39;m guessing all of that should be handled by the object loader library but that&#39;s a big guess.</p><p>As amarillion said, we&#39;d need to see some code first!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dizzy Egg)</author>
		<pubDate>Tue, 12 Jan 2021 23:12:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi all:</p><p>   I tried to send a zip file of the library. Hope I did it right.</p><p>   Thanks for your time. See above. I am using Linux.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Scooter)</author>
		<pubDate>Wed, 13 Jan 2021 00:41:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m guessing you&#39;re seeing this line:</p><p>__glmWarning(&quot;glmLoadTexture() failed: Unable to load texture from %s!&quot;, filename);</p><p>Which should include the path that it&#39;s trying to load from; what is the full error you see when running it...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dizzy Egg)</author>
		<pubDate>Wed, 13 Jan 2021 01:04:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi Dizzy:</p><p>   That is exactly what I am receiving. It loads the .mtl file fine.</p><p>The texture file is in the same directory as the .mtl file. Some lines</p><p>in one file had been greyed out. Thought I had found the problem. I still</p><p>believe that is what is wrong. When I fixed that more problems showed up.</p><p>The path I had is correct or the .mtl file would not have been loaded.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Scooter)</author>
		<pubDate>Wed, 13 Jan 2021 01:23:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I don&#39;t think you&#39;re going to be able to load textures with that version of the object loader. The most you can do is load an object with multiple materials (I&#39;ve attached one that I got working).</p><p>But as for actual textures (jpeg/png etc) that version of the object loader doesn&#39;t seem to work properly. There is an updated version <a href="https://www.eden.net.nz/7/20031008glm.html">HERE</a> that works with .sgi textures, but it&#39;s not complete.</p><p>I think you&#39;d need to upgrade to a newer (possible C++) version, or add the required code yourself.  </p><p>EDIT:</p><p>Good news! I spent a few hours more on it, and managed to get it working with .jpg textures. I had to link libjpeg, and had to define #HAVE_LIBJPEG in a few files.</p><p>This video <a href="https://youtu.be/o5hJbm3B0Kk">HERE</a> shows me moving the model on the left, and the .jpg texture on the right.</p><p>I also had to manually edit the filename, seems there&#39;s some confusion when to use &quot;\\&quot; and when to use &quot;/&quot;, not sure why.</p><p>I&#39;ve got to stop for now, but I&#39;ll tidy it up tomorrow and try to get .png working as well, I&#39;ve got a model with .jpg and .png textures so it will be cool to try and get that working. I&#39;ll try and show you what I changed to get it working!</p><p>EDIT 2:</p><p>I should go to bed really, but I was determined to get the PNG working. This new video shows a model loaded with JPG and PNG (the PNG is the image on the right):</p><p><a href="https://youtu.be/QxmlTXDj1rQ">VIDEO</a></p><p>The JPG images it loads are used for environment reflections (multipassing etc) so although they&#39;re not used for rendering they do load ok. There&#39;s 7 materials/textures loaded in total.</p><p>Again, I had to link libpng, and add some #define HAVE_LIBPNG to the source code. </p><p>EDIT 3:</p><p>Getting the hang of it now; you CANNOT have spaces in the file name (causes all sorts of issues), and certain things make it fail, like bump maps etc. I may wrap it up into a more simple loader, just for my own use in 2D games (would be cool to have some spinning 3D elements etc) but it needs A LOT of work to become a fully functioning object loader. Worth a few more nights tinkering though!</p><p><span class="remote-thumbnail"><span class="json">{"name":"612830","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/7\/e76f5ca3a2da44a52a3dba3e6ae85a2e.png","w":602,"h":632,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/7\/e76f5ca3a2da44a52a3dba3e6ae85a2e"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/e/7/e76f5ca3a2da44a52a3dba3e6ae85a2e-240.jpg" alt="612830" width="240" height="251" /></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dizzy Egg)</author>
		<pubDate>Wed, 13 Jan 2021 04:56:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi Dizzy:</p><p>   That is great news! Glad you got it figured out. I posted another</p><p>program to display obj files that may be better for your games. It is</p><p>really fast and is only one file. It needs much work to be able to do</p><p>it all. I expect you could fix that without much trouble. I watched</p><p>your video. Great job! Have a great day!!!!!!!!!!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Scooter)</author>
		<pubDate>Wed, 13 Jan 2021 19:54:32 +0000</pubDate>
	</item>
</rss>
