Regarding AddCubeSceneNode()

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
ansu832001
Posts: 95
Joined: Thu Mar 01, 2007 6:39 am

Regarding AddCubeSceneNode()

Post by ansu832001 »

When iam using AddCubeSceneNode() to draw a Cube,iam getting the cube in black color,how to change its color?? ,i mean i want to apply a bmp file as texture.

I am now using the code below to add texture,but failing to add

node.SetMaterialTexture(0,texWall);

/*where texWall is

texWall = device.VideoDriver.GetTexture(@"..\..\wall.bmp");


*/

Help Needed

Thanks & Reply
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Add a light to your scene, or setMaterialFlag(video::EMF_LIGHTING, false);
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
ansu832001
Posts: 95
Joined: Thu Mar 01, 2007 6:39 am

Post by ansu832001 »

Thank you for your reply,its working!!
dbest
Posts: 10
Joined: Wed Jan 02, 2008 4:45 pm

Post by dbest »

I was trying out the simple tutorial and trying to render a cube on the screen with the addcubescenenode function, but there is no cube displayed on the screen. I am using Irrlicht 1.4 version. All i see is a white window, i changed the background to white color as i thot the cube is not visible.

Code: Select all

#include <irrlicht/irrlicht.h>

using namespace irr;

using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;


int main() { 

 IrrlichtDevice* device = createDevice(EDT_SOFTWARE, core::dimension2d<s32>(640,480)); 
 device->setWindowCaption(L"Irrlicht Engine Demo");

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


 ISceneNode* cube = smgr->addCubeSceneNode(10);
 cube->setPosition(vector3df(0,0,5)); 
 cube->setMaterialTexture(0, video->getTexture("sydney.bmp"));
 cube->setMaterialFlag(video::EMF_LIGHTING, false);

  
 while(device->run() && device) { 
                     
  video->beginScene(true, true, video::SColor(255,255,255,255)); 
  smgr->drawAll(); 
  video->endScene(); 
 } 
}
EDIT: Solved, when i added a camera to the scene,
ICameraSceneNode* camera = smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,0,0));
Post Reply