Page 1 of 1

How set more that one texture...

Posted: Wed Jul 07, 2004 11:52 pm
by Vinetu
Hi all! I come back with new problems:))) I with DeleD editor create simple map. This map have two textures. I with LithUnwrap change material names and then load with Irrlicht. Geometry loads perfecty, but map has only one texture on it. I think it is problem with setMaterialTexture(). How to fix it? Does setMaterilaTexture(0, driver->getTexture("texture.bmp")) texture layer don't work? Any suggestions?



My code
-----------------------------------------------------------------------
#include <irrlicht.h>

using namespace irr;

#pragma comment (lib, "Irrlicht.lib")

int main()
{
IrrlichtDevice* device = createDevice(video::EDT_DIRECTX8,
core::dimension2d<s32>(640,480),16, false, false);

scene::ISceneManager* smgr = device->getSceneManager();
video::IVideoDriver* driver = device->getVideoDriver();

device->setWindowCaption(L"Project: Bandymai");

scene::ISceneNode* node = smgr->addAnimatedMeshSceneNode(smgr->getMesh("bandymas.x"));

if (node)
{
b]node->setMaterialTexture(0, driver->getTexture("BRICK4.BMP"));
node->setMaterialTexture(1, driver->getTexture("carpet3.bmp"));[/b]

node->setMaterialFlag(video::EMF_LIGHTING, false);
}

smgr->addCameraSceneNodeFPS();

while (device->run() && driver)
{
driver->beginScene(true, true, video::SColor(0, 100, 100, 100));
smgr->drawAll();
driver->endScene();
}

device->drop();

return 0;
}
-------------------------------------------------------------------------
Code ends here

Posted: Thu Jul 08, 2004 1:53 am
by thesmileman
Is one of your textures transparent or have an alpha channel so that you can see through to the other texture?

Posted: Thu Jul 08, 2004 9:47 am
by Vinetu
My textures aren't transperant or with alpha channel.

Posted: Thu Jul 08, 2004 10:05 am
by puh
Please, read API first:
http://irrlicht.sourceforge.net/docu/na ... o.html#a68
You should use different material mode to use 2 textures simultaneousely.

P.S. Next time enclose your code with [ code ] ... [ / code ] tags.

Posted: Thu Jul 08, 2004 8:21 pm
by Vinetu
Thanks puh, but I don't find in documentation. Can you say where is it?

Posted: Fri Jul 09, 2004 10:12 am
by puh
Example:

Code: Select all

curNode->setMaterialTexture(0, driver->getTexture("media\\ext\\water0.jpg"));
curNode->setMaterialTexture(1, driver->getTexture("media\\ext\\water1.jpg"));
curNode->setMaterialFlag(video::EMF_LIGHTING, false);
curNode->setMaterialType(video::EMT_TRANSPARENT_REFLECTION_2_LAYER);
setMaterialFlag
setMaterialType

Posted: Sat Jul 10, 2004 9:42 am
by Vinetu
Thanks a lot!