Problem loading a obj

Hi guys. I´m facing a realy big problem right now.
I´m using visual studio and C to code a litle project for universiti in OpenGL.
Now i´m tryng to load a .Obj and hes .mtl file.
But if i load into my tatcher example it works, but in my project it doesnt work. They have the same primitives, but in my teatcher example he have textur, and in my code, the .Obj get hes format, but cant get his textur… Someone have any tip?

Here’s a tip. Please write your question in proper English and not it text msg format liek you are on your phone or something.
Perhaps that way we won’t have to read your post 6 times and still not understand a single word.
Try to pose the question in such a way that it’s thoughtfully layed out, direct and includes as much detail as possible.

Sorry for the english. Just formatted the computer and was accustomed to auto correct :(.
My problem is that, when i load an .Obj file, i get the structure, but i don’t get the colors of the .obj. I have the .obj and the .mtl files on the same place. I´, trying to load with GLM in my project. But if i use wings 3D they have the right color. Any tip?

Open the obj file with any text editor and see how the colors are stored ?

yes, they are at the .mtl file right? and it calls the .mtl file with the command mtllib cbc001.mtl right?

Tough problem dude. I hope that you get it fixed soon. And by the way, your english isn’t that bad. :smiley:

Ty. but tough situations dont handle by them selfs sadly :\ I rely need to find the solution… Or start trying .Obj until i find some one that work xD

And by the way, your english isn’t that bad

Really? Where in the first post did you understand that his problem centered around displaying colours?

If people don’t write questions properly and proof read what’s been written, they can’t expect any sort of help can they?

BionicBytes… You are right. My first post was a rely big mess xD But now… Can you help me? :D. I´m trying to load a chest with GLM. I can load the chest properly, i mean hes shape. But i cant load the color. I loaded a beach ball and i couldn’t load the proper color too. But i loaded a soccer ball and it worked :\

I don’t use GLM so I’m not familiar with what it offers. How do you load the obj and mtl files? Do you parse them your self or use 3rd party.
I need to check the definition of obj files but I thought that colours were defined as part of the material definition in the mtl file.

GLMmodel *obj;
       obj = glmReadOBJ("porsche.obj");

	   	   glLightfv(GL_LIGHT0,GL_AMBIENT, amb);
	   glLightfv(GL_LIGHT1,GL_AMBIENT, amb);
	   	   glLightfv(GL_LIGHT0,GL_DIFFUSE, diff);
	   glLightfv(GL_LIGHT1,GL_DIFFUSE, diff);
	   glLightfv(GL_LIGHT2,GL_AMBIENT_AND_DIFFUSE, diff);

I use this in deferent parts of the project, but it is all the code i need to use. The translates is to place the object in the right position. I already loaded the object in Wings 3D. And it load properly. I only get problems wen i load with GLM. And all the color or texture should be at the mtl file :S

Sorry I can’t help with GLM.
It does seem likely GLM is not supporting obj models using vertex colours?
Are you sure there is no other obj commands in GLM to enable the per vertex colour data?

Not really sure :\ thats the problem. My teacher gave us an example and said “Now do it by yourself” and i have my hands a little tied up :S I´m freaking out cause i cant find anything in internet:S

If GLM can read obj files then it must be documented. Find and read the manual?

Change glmDraw(obj,GLM_SMOOTH|GLM_MATERIAL) to glmDraw(obj,GLM_SMOOTH|GLM_COLOR). Does it work ?

[edit] You can get the glm (GLModel) library (written by Nate Robins) right here : (check the ‘contributions’ link for linux/Mac port)

See the other .obj thread in this forum, probably a classmate.


Found the solution GML dont load texture. My teacher told me to go to glm.c and change it so he can read the line of the .mtl file where it show the texture (the map_Kd line from the .mtl) and make the gml.c read that line and store it,so i can use Devil Later to load the texture in the .Obj. Was i clear? sry for English, but it is a mess even for me xD

The code was too big to put all together Ty for all guys. :smiley: