hey,
i'm a newbie, newcomer, beginner, blablabla..
i loaded a mesh from an .obj file (wavefront),
scene::IAnimatedMesh* terr = smgr->getMesh("terr.obj");
scene::ISceneNode* tnode = 0;
if (terr) tnode = smgr->addOctTreeSceneNode(terr->getMesh(0));
and applied a texture to it using :
tnode->setMaterialTexture(0, driver->getTexture("terr.jpg"));
the mesh shows up.. but it's black..
it's supposed to be a mountain (grassy)..
is it allowed to put textures on meshes at all ? or am I doing something wrong ? (which is probably the cause)
dunno if this helps :
when instead of 0 i put 1 in setMaterialTexture, the mountain came up green, but the whole mountain was all the same kind of green, just one colour.. obviously terr.jpg contains more than 1 colour..
thx
daemon
applying a texture to a mesh
-
daemon
i dunno.. default.. i didn't do anything with the lighting..
there are other nodes in the scene and i see them perfectly..
there's a testnode with texture just next to it and it's ok..
anyway.. i now think the problem might lie elsewhere..
i tried applying a texture to this mountain from another program (3d modeller) and it did the same.. so it's not irrlicht.. (sorry about posting here
).
anyone has a clue of what's going on ?
i opened a md2 model applied a texture it was ok..
i opened a obj file (which was a mountain created with bryce) applied a texture and it was monochromatic
thx
daemon
there are other nodes in the scene and i see them perfectly..
there's a testnode with texture just next to it and it's ok..
anyway.. i now think the problem might lie elsewhere..
i tried applying a texture to this mountain from another program (3d modeller) and it did the same.. so it's not irrlicht.. (sorry about posting here
anyone has a clue of what's going on ?
i opened a md2 model applied a texture it was ok..
i opened a obj file (which was a mountain created with bryce) applied a texture and it was monochromatic
thx
daemon
-
daemon
You need to manually load the textures into Irrlicht with the setMaterialTexture() function. Set the texture level to 0 and it will override the texture you have set in ( unless you want to put the textures in the same folder as the mesh ). I don't know how to override two textures on a model, however I would like to *hint hint*
Edit: I noticed on a second glance that you did put the setMaterialTexture in the first one so you have probably already done that, soz my bad. Does Irrlicht's console say that the texture is loaded?
Edit: I noticed on a second glance that you did put the setMaterialTexture in the first one so you have probably already done that, soz my bad. Does Irrlicht's console say that the texture is loaded?
Oh yeah, I didn't notice that before. You haven't got any lights in the scene right? You need to set this:
That will light the model, at the moment nothing is lit up so they would look black.
Code: Select all
node->setMaterialFlag(video::EMF_LIGHTING, false);