Can't make textures to show up.

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
CZestmyr
Posts: 72
Joined: Sat Feb 12, 2005 7:11 pm
Location: Czech Republic
Contact:

Can't make textures to show up.

Post 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;
}
CZestmyr
Posts: 72
Joined: Sat Feb 12, 2005 7:11 pm
Location: Czech Republic
Contact:

Post by CZestmyr »

Oh yes, the two textures were meant to try out the multitexturing.
kaeles-notlogged

Post 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
William Finlayson
Posts: 61
Joined: Mon Oct 25, 2004 12:11 am

Post by William Finlayson »

It does work with OpenGL on Windows, just not under Linux with the official release.
Murphy
Posts: 290
Joined: Mon Dec 13, 2004 12:06 am
Location: United States
Contact:

Post by Murphy »

I think the problem is that Irrlicht's OBJ loader doesn't load textures.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

believe Murphy! he is to .Obj what Vermeer is to .X :wink:
Post Reply