Page 1 of 1

Can't make textures to show up.

Posted: Mon Feb 14, 2005 10:38 am
by CZestmyr
Hi! I've got this little problem: I am making a little program to test, how Irrlicht shows textures.

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;
}

Posted: Mon Feb 14, 2005 10:39 am
by CZestmyr
Oh yes, the two textures were meant to try out the multitexturing.

Posted: Mon Feb 21, 2005 2:40 pm
by kaeles-notlogged
if your using opengl, the multitexturing doesnt work (GRRRRR)

and if your using directx, try adding something like
node->setMaterialType(EMT_MATERIAL_2_LAYERS)
or something, its in the docs.
just look up the enumerated material types :-D

Posted: Mon Feb 21, 2005 2:54 pm
by William Finlayson
It does work with OpenGL on Windows, just not under Linux with the official release.

Posted: Mon Feb 21, 2005 3:11 pm
by Murphy
I think the problem is that Irrlicht's OBJ loader doesn't load textures.

Posted: Wed Feb 23, 2005 3:36 am
by afecelis
believe Murphy! he is to .Obj what Vermeer is to .X :wink: