I've created a little cube model first in 3dsMax, when I tried the 3ds format, then in Blender to try out the obj format. None of them worked. I mean, yes, they showed up, but without the texture, just in weird brown color. My textures were also brown, so I thought, that maybe the UVW coordinates aren't exported in the files somehow. I think I've tried everything by now, even to look in the forums.
Please help. Here's the short code, it just loads the mesh and adds it with a scene node, as well as it adds a controlable camera.
Code: Select all
#include "irrlicht.h"
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#pragma comment(lib, "Irrlicht.lib")
int main () {
IrrlichtDevice* device = createDevice(EDT_OPENGL, dimension2d<s32>(800,600));
if (device == 0) return 1;
ISceneManager* smgr = device->getSceneManager();
IVideoDriver* driver = device->getVideoDriver();
IAnimatedMesh* cube1 = smgr->getMesh("cube.obj");
IAnimatedMeshSceneNode* node_cube1 = smgr->addAnimatedMeshSceneNode(cube1);
if (node_cube1) {
node_cube1->setMaterialFlag(EMF_LIGHTING, false);
node_cube1->setMaterialTexture( 0, driver->getTexture("texture1.bmp") );
node_cube1->setMaterialTexture( 1, driver->getTexture("texture2.bmp") );
}
smgr->addCameraSceneNodeFPS(0,50.0f,50.0f);
while (device->run()) {
driver->beginScene(true, true, SColor(255,0,0,0));
smgr->drawAll();
driver->endScene();
}
return 0;
}