Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » No lick with the obj file

This thread is locked; no one can reply to it. rss feed Print
No lick with the obj file
Scooter
Member #16,799
January 2018

Hi all:

Well I have been on this loading of a Wavefront Obj file for 5 months!

I have tried everything under the sun and gotten NOTHING to work!

Edgar gave me a good tip and I thought I had it, but no luck!

I believe it was Steve Terry that gave me a program, but I was not able to

get it to work! I believe it was designed to work on Windows. I tried to fix

it to work on my linux, but no luck.

I have a message for someone named bamccaig: You were exactly right. You said

I could not do it and you hit the nail square on the head! Should have

taken your advice!

Anyway if someone wants to earn a little money and wants to help me on this,

let me know. Maybe we can work something out.

I have posted my program above. It is a great program. It will load and

display any obg file you throw at it! Just won't display the .mtl file or

any texture file! That is the problem that I want fixed! Must run on linux!

Download the program and put in your obj file and move the mouse to rotate

the model! Thanks all for your time!

bamccaig
Member #7,536
July 2006
avatar

I think you misunderstood me. I wasn't trying to discourage you or suggest that you can't do it. I was simply speaking from experience. If you bite off more than you can chew you will likely make no progress because the steps needed to advance are far too difficult to make in such short time. That's why I suggested starting off with something simpler. You'll have more fun getting things working than constantly being blocked, and you'll be more likely to be motivated to continue getting things done having fun.

We also tend to underestimate just how much work something seemingly simple can be. Particularly if we have no experience doing anything like it before. You might think that it's a weekend project, but it might be more of a decade project or a life-long project. Software is almost always underestimated because the truth is scary. :o

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

luck

The title should be mostly, "No luck with the .mtl file", but we'll forgive you.

A .mtl file consists of materials, that's it. Do you know how to light and texture objects? That's what it is, a texture library for the materials used within the .obj file. Each entry with a material in the obj file is textured with the corresponding texture file loaded with the .mtl file.

I was working on this ages ago. I suppose I could go back to it for a while. I could also use some cash if you're really convinced you should let go of money for this.

Edgar

EDIT
Between you, me, and Mark Oates, we could whip up a library for this sort of thing. Last I knew MO already had it done but it was part of his own library, so you were limited to using FlareGUI or some such IDK ICR 8-)

Arthur Kalliokoski
Second in Command
February 2005
avatar

I saw this post about 10 hours ago, and downloaded the file and tried to compile it as is and got

display_model.cpp:2:23: fatal error: glm/glm.hpp: No such file or directory compilation terminated.

I don't do c++ because I'm not smart enough.

I went googling for some stuff I did 7 to 10 years ago and made a couple of posts about it, but all I could find in the rabbit hole was this.

I used to have a program to parse obj files into a binary thing, but I'd have to dig around to find the hard disk and dock it.

EDIT: I'm just now starting to get back into programming after a 5 year break and I continued down that rabbit hole (google search term "kalliokoski site:allegro.cc") for 4 hours and it's like pulling off a scab. Except for waking my roomies up with the uproarious laughter now and then...

They all watch too much MSNBC... they get ideas.

DanielH
Member #934
January 2001
avatar

I don't do c++ because I'm not smart enough.

Intelligence is not the same as Knowledge. You can be smart and be ignorant.

There are good things and bad things about C++, but I prefer over C. It's not hard. Hardest part for me is not knowing how to do things. Classes took me the longest mostly because the name sucks. I understand struct, but class? Who the heck named it class? :)
"Object" maybe, but "class"

Once I understood that class is struct, it made sense.

Some call it being lazy or extra baggage, but if it makes life easier. Work smarter not harder philosophy.

Scooter
Member #16,799
January 2018

Arthur:

Thanks for the reply. I checked out the cube program. Very nice!

What you need to do to check out my program is to install the glm library.

This is the reason for your error.

Enjoy and have a great day!

Edit: I tried to post the library for you, but the website would not let

it go through. Sorry.

Mark Oates
Member #1,146
March 2001
avatar

Last I knew MO already had it done but it was part of his own library, so you were limited to using FlareGUI or some such IDK ICR 8-)

As for code that loads OBJ files:

I don't suggest licking them, but they might be a helpful reference.

Scooter, I should focus your attention to the core logic of it all, and note that doesn't look too dissimilar what you already have in your original attachment.

Edgar, if you're interested, the latest design principal of AllegroFlare is to have completely independent components with minimal framework coupling. As such, some parts do plug together to make a composite framework (if someone wanted to use it). But, anything that's potentially an independent component should (eventually if not now) be usable separately. AllegroFlare is a bit behind the design curve though, to be honest. The hot new stuff just uses pieces of AllegroFlare, and does its own system setup manually through calls to Allegro.

I don't do c++ because I'm not smart enough.

I don't think there's precedent to say such a thing! I use a very limited subset of C++ language because I don't like complicated things. Generally, I'm only interested in these things:

1) Grouping concepts together so that they are easier to manage and understand (putting things in a class).
2) Preventing unrelated concepts from being grouped together (separation of concerns).
3) Understanding dependencies. This means having an explicit understanding of the needed header files, libraries, setup, and the like that you need to have in place for your thing to work. All of these are taxing and you inherit their demands anytime you add more stuff. The more you have to put on, the more impossible it will be to untangle when you need to so you constantly have to be vigilant not to pull in more stuff "because it's easier".

Generally speaking, as long as these principals are kept top of mind, everything else is semantic or overly clever and you shouldn't feel like you're not smart enough.

----

Edit:

There's also the examples/ex_model_viewer.cpp file. That might help add some context to the usage. I was able to build it (though I had to hard-code the path strings in the program which are out of date), and it displayed the heart-item-01.obj file with the texture:

{"name":"612676","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/5\/458f1a9b52b1cdf029cd3c55d4426c94.png","w":800,"h":644,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/5\/458f1a9b52b1cdf029cd3c55d4426c94"}612676

Scooter
Member #16,799
January 2018

Mark Oates:

Thanks for your reply. First time I have heard of allegro_flare.

Looks very good! Would love to give it a try. I have allegro 5.2.5 loaded.

When you have time could you post steps to take to make it work?

I promise I will not lick any of your programs. Maybe a small main.cpp to

get started or can I use a main I already have.

Thanks.

Mark Oates
Member #1,146
March 2001
avatar

Scooter said:

First time I have heard of allegro_flare. Looks very good! Would love to give it a try.

Well, I don't recommend it :P

At best, you might be able to look at some of the classes and extract some useful parts. The build system is completely fused with several other projects and likely will not work on... well... any computer other than mine. For that, it needs some work, so the library build is completely inaccessible without some up-front changes to the code.

Mostly this has happened because there aren't enough practical use cases for the library and hardly anybody has any reason to use it. So as an executive decision, I decided to align all of my projects into the same build system, which includes a pretty hefty set of dependencies. This is the Makefile. This was done so that all the development I did on my (cross-referencing) projects would swim and progress together, and not be slowed down by updates or managing synchronization across all the projects.

Scooter
Member #16,799
January 2018

Mark Oates:

Now that is a shame. I had everything ready to go when I heard from you.

Oh well, I can use my program like it is. Sure would like to see some color.

Thanks for your time, have a great day!

bamccaig
Member #7,536
July 2006
avatar

Pfffft. Just because you have to make it work yourself doesn't mean it isn't worth getting working. :D Maybe Mark is the crazy evil genius artist creating the brilliant ideas that humanity can benefit greatly from, but doesn't recognize their value for others, has no interest in monetary wealth, and makes them unnecessarily difficult to use yet cares not at all who sees or takes it. You could be the entrepreneur to make it aesthetically pleasing and make it rich! Or more likely waste a few weekends, have some fun, and learn a few things, before finding another shiny object to be fascinated with. >:(

(Copyright © 2020 bamccaig, Sensi Star)

Copyright ©1999-2020, by Matthew Leverton :o>:(

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Scooter, this is like asking someone to do your homework for you. You get the grade, but you don't understand what's going on, so you both lose.

I can help you understand a .mtl file, it's a text file and it's not that complicated. You just have to write the code that parses the materials, loads the textures, and stores the TexCoords in your model.

Scooter
Member #16,799
January 2018

Edgar:

Thanks for your comment! T think it was uncalled for! But that is OK!

I decided yesterday to use the program as it is! I spent most of today

cleaning up 4 hard drives of all the crap I had accumulated over the last

5 months trying to figure this thing out! Sorry to have bothered you!

I will do my best to NEVER post on this site again!

Have a nice evening!

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Scooter, I assure you no offense was intended. You just came off as asking us to write it for you, which would prevent you from understanding why and how it works. That's what I want in the end, for you to learn and grow. That is all.

Sorry if I came off as harsh, perhaps my wording could have been better.

Also, you are NOT to be ashamed for asking for help, that's what this forum is for. But it would be better for us to explain this to you so you understand it, and can program it yourself in the future if the need should arise.

Scooter, again, you're totally welcome here. But maybe the answer you got wasn't the one you were hoping for, I don't know.

I already said I would be willing to help you. That offer still stands.

Edgar

Go to: