So I wrote a routine to load a blender .obj file into my program. This is just a simple cube:
{"name":"608542","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/f\/efc6caeda9d0a6762939e1e1b5eaec9b.png","w":644,"h":509,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/f\/efc6caeda9d0a6762939e1e1b5eaec9b"}
That exports like this:
# Blender v2.64 (sub 0) OBJ File: '' # www.blender.org o Cube v 300.000000 -300.000000 -299.999969 v 300.000000 -300.000000 300.000000 v -300.000031 -300.000000 299.999939 v -299.999878 -300.000000 -300.000122 v 300.000153 300.000000 -299.999847 v 299.999817 300.000000 300.000183 v -300.000122 300.000000 299.999878 v -299.999969 300.000000 -300.000000 s off f 1 2 3 4 f 5 8 7 6 f 1 5 6 2 f 2 6 7 3 f 3 7 8 4 f 5 1 4 8
And when displayed it looks like this:
{"name":"608541","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/c\/ec2f741c5e888f24a33d98427083e1f5.png","w":644,"h":509,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/c\/ec2f741c5e888f24a33d98427083e1f5"}
So obviously I'm getting something right. It looks like the coordinates are being imported correctly, but not being drawn correctly. I tried different ALLEGRO_PRIM_TYPEs because it seems like that might be what's causing it to not work, and they changed the way it displayed but never displayed correctly. I tried reversing the order of the vertexes, cause, who knows that might do something.
here's the import function:
(I also have no idea how to get the texture applied/exported/imported.)
[edit:] After more poking, I think it has to do with the faces, I have an idea.
[edit 2:]
boohm! got it.
{"name":"608544","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/c\/2c1537e594341a2fd814862e306a9752.png","w":629,"h":494,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/c\/2c1537e594341a2fd814862e306a9752"}
{"name":"608543","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/9\/e96cda0491c652395dc651c31aedaad1.png","w":629,"h":494,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/9\/e96cda0491c652395dc651c31aedaad1"}
(with random colors on the vertices.)
Damn Oates! Nice work!
Mark, is the code in your post the latest one that loads correctly? I can't see how you handle vertex ordering in the faces.
Now my loader takes in uv textures!
{"name":"608545","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/8\/b895d2e258bd8b16efc906985ddd3da6.png","w":852,"h":682,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/8\/b895d2e258bd8b16efc906985ddd3da6"}
It's all weird and half the coordinates are flipped and stuff, but who cares!! I can hack around that until I sort it out later! Celebration!!!
Mark, is the code in your post the latest one that loads correctly? I can't see how you handle vertex ordering in the faces.
Here's the code, now. It's nasty don't look at it
Cool, I am not familiar with blender obj files.....has it any info about the texture embedded in it?
Nice job anyway Mark.....I still struggle a bit with how you handle vertex indexes but it is really really cool.