Advertisement

Milkshape Materials

Started by December 20, 2002 10:33 PM
5 comments, last by Feblex 22 years, 2 months ago
Continuing on with my experimentation of Milkshape model loading, I''ve tried to texture my models, but to no avail. While I realize the code from the tutorial is supposed to do that, it hasn''t worked since I began using my own models. Basically, I''ve used a BMP as a material, and applied it to the entire model. However, when I run my program, the model continually loads white. The code from the tutorial is unedited,(at least the model and material loading stuff) and the BMP used as the material is 128*128. I''ve even poked around in the MS3D file in Wordpad, and the path for the BMP looks correct. The only problem I can think of is that I didn''t apply the material correcly. Has anyone else had this problem? How could I fix this? Any help, as always, is appreciated!
That happened to me before, although after figuring out that I didn''t used glEnable(GL_TEXTURE_2D). Also, if you use materials (i.e Ambient, Diffuse, etc) make sure you create at least one light on the scene to see ambient/diffuse colors.
Good luck.

" Do we need us? "


Ionware Productions - Games and Game Tools Development

Advertisement
Thanks for the quick reply! Unfortunately, enabling lighting and such didn''t do the trick. The model is still rendered straight white.
The most common error is not sizing the texture properly:

it has to be a power of 2

2^n

2,4,8,16,32,64,128

If thats not your problem
Try this handy dandy code, it might help you out

char * Answer;
Answer = (char *)gluErrorString(glGetError());
MessageBox(NULL, Answer, "OpenGL Error", MB_OK);

Place it after you call your glTexImage2D

then look up the error message in the online blue book, it will tell you all possible problems

~~~~~Screaming Statue Software. | OpenGL FontLibWhy does Data talk to the computer? Surely he's Wi-Fi enabled... - phaseburn
I know my biggest problem was this:

Make a folder called Models

gameproject\models

then, copy all of your textures into this folder.

Now, save your milkshape model in the

gameproject folder.

(Trust me)

Now, once you have it saved, apply the textures that you put in the models folder.

Once you are all finished, save your model. Now, move your model into the models folder

gameproject\models

Trust me, you HAVE to do this, its such a pain in the ass, but this is how i have gotten it to work.

NOTE: DO NOT SAVE AS!!!!!!!!!!!!!!! Physically MOVE the model file into the models folder.

if you open a ms3d model file in notepad, you wioll see the locations of the textures. Remember that your game.exe will read this location, so it loads the textures with the location in the model file. So, if your model says the textures are held in .\models and your exe is in gameproject, your model will get the correct texture location. If you save your model and your textures in the same folder, then the model file will hold .\ as the texture location, so your EXE will try to load .\texture.bmp which is not correct, it needs to be .\models\texture.bmp

Get it?

Maybe this is not your problem, but if it is, let me know if it works for you.

IT Administrator / Software Engineere
http://drdsoftware.cjb.net

[edited by - titan2782 on December 21, 2002 2:00:07 AM]
Dustin DavisOwner / CEOProgrammers Unlimitedwww.Programmers-Unlimited.com
WOOT!! Thanks a bunch Titan! It worked! It really worked! However, I can''t seem to make it work with multiple models.

Nevertheless, thanks a bunch!!
Advertisement
Wouldn''t it be easier to just program in some kind of parser that takes the path name and rips the filename.bmp out, then appends it to whatever you want your search path to be? That way you don''t have to edit every single model, and if people want to make models for your game, they probably won''t want to have to do that.

This topic is closed to new replies.

Advertisement