I'm doing my firsts steps with the irrlicht engine and c++... I used to program in other languages so far and i have to get used to both (irrlicht/c++)
I changed the standard example code a bit to have a fps camera and load a .3ds file with external textures
Now I wonder why the textures of the model are not shown... i tried different things like setting the lighting on and off, adding ambient light and so on... no texture.
Heres the code:
Code: Select all
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
int main(int argc, char** argv)
{
IrrlichtDevice *device =
createDevice(EDT_OPENGL, dimension2d<u32>(640, 480), 32,
false, false, false, 0);
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
guienv->addStaticText(L"Game Engine Prototype",
rect<int>(10,10,200,22), true);
IMesh* mesh = smgr->getMesh("mainboard.3DS");
IMeshSceneNode* node = smgr->addMeshSceneNode( mesh );
if (node)
{
node->setPosition(core::vector3df(0,-50,50));
node->setMaterialFlag(EMF_LIGHTING, true);
//node->setMaterialFlag(EMF_ANTI_ALIASING, true);
//node->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
// node->setFrameLoop(0, 310);
// node->setMaterialTexture( 0, driver->getTexture("p4sba-mb.jpg") );
}
smgr->setAmbientLight(video::SColorf(0.3,0.3,0.3,1));
SKeyMap keyMap[8];
keyMap[0].Action = EKA_MOVE_FORWARD;
keyMap[0].KeyCode = KEY_UP;
keyMap[1].Action = EKA_MOVE_FORWARD;
keyMap[1].KeyCode = KEY_KEY_W;
keyMap[2].Action = EKA_MOVE_BACKWARD;
keyMap[2].KeyCode = KEY_DOWN;
keyMap[3].Action = EKA_MOVE_BACKWARD;
keyMap[3].KeyCode = KEY_KEY_S;
keyMap[4].Action = EKA_STRAFE_LEFT;
keyMap[4].KeyCode = KEY_LEFT;
keyMap[5].Action = EKA_STRAFE_LEFT;
keyMap[5].KeyCode = KEY_KEY_A;
keyMap[6].Action = EKA_STRAFE_RIGHT;
keyMap[6].KeyCode = KEY_RIGHT;
keyMap[7].Action = EKA_STRAFE_RIGHT;
keyMap[7].KeyCode = KEY_KEY_D;
smgr->addCameraSceneNodeFPS(0,100.0f,0.1f,-1, keyMap, 8);
device->getCursorControl()->setVisible(false);
while(device->run())
{
driver->beginScene(true, true, SColor(255,200,200,200));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();
return 0;
}