Stupid question

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Mercyful
Posts: 8
Joined: Tue May 29, 2007 5:01 pm

Stupid question

Post by Mercyful »

Hi, I'm the noobiest person in the world and I got a super-dumb question, I've been the whole day trying to make this work. Well... don't laugh.

I'm trying to set a texture to a model I downloaded but doesn't work, I use as base tutorial 4 Movement from the SDK.


scene::IAnimatedMesh* gun = smgr->getMesh("media/mygun.x");
scene::ISceneNode* node = 0;
node = smgr->addAnimatedMeshSceneNode(gun);
node->setMaterialTexture(0, driver->getTexture("guntext.bmp"));
node->setMaterialFlag(video::EMF_LIGHTING, false);

I tried the texture with the cube from de tutorial and worked perfectly.
The .x shows kind of blue.

Well I hope I haven't bother you too much, thanks.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Code: Select all

node->setMaterialTexture(0, driver->getTexture("guntext.bmp")); 
Is the file guntext.bmp in the same directory as the executable, or more specifically, the working directory? I'd think it would be in the same directory as the model file. If that is the case, then you need to provide the path to the texture.

Code: Select all

node->setMaterialTexture(0, driver->getTexture("media/guntext.bmp")); 
Mercyful
Posts: 8
Joined: Tue May 29, 2007 5:01 pm

Thanks

Post by Mercyful »

Thank you a lot for the answer but... no, it's not that I tried that but it's the same, I also tried with .3ds but still the same, oh and I just downloaded another model and seems like work but the texture looks green, but besides this model no other model work.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Is there some output on the console (the dos window...)?
Mercyful
Posts: 8
Joined: Tue May 29, 2007 5:01 pm

Thanks again

Post by Mercyful »

Thanks again, well I check the DOS windows and says that the texture and models are ok.
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

Post by Strong99 »

how many textures has the gun have? ( in the model self? )
i guess it has something to do with the texture coordinates
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Then there are probably no texture coordinates in the model. Textures won't work on it without doing some more stuff, e.g. uv mapping it in a 3d modeller.
roxaz
Posts: 575
Joined: Tue Jan 23, 2007 8:35 pm
Location: LT

Re: Stupid question

Post by roxaz »

Mercyful wrote:Hi, I'm the noobiest person in the world and I got a super-dumb question
Well noone is perfect. Noone born with all knowledge. Plz respect yourself and dont say that again :)
Mercyful
Posts: 8
Joined: Tue May 29, 2007 5:01 pm

THANKS

Post by Mercyful »

Well thanks again, uv mapping??? that means that I should do something with the model when I am making it? so I can't use models I download, I tried use the makePlanarTextureMapping from Special_FX tutorial but nothing happens, also tried the same models in the meshviewer, in irrsed, and in visualeditor and can't load any textures neither, at exception of one only model that is able to load textures, how I suppose to load a model in irrlicht if i don't know if is't gonna load the texture or not
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Many downloadable Models do not contain textures and texture coordinates. You'll have to do it on your own. PlanarMapping should work, but most often it won't result in pleasant models.
Mercyful
Posts: 8
Joined: Tue May 29, 2007 5:01 pm

Post by Mercyful »

Thanks for you help.
I'm gonna read some more about import models to irrlicht, I guess the problem is the uv mapping, thanks, you all are really kind.
Post Reply