Material Question

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
bruZard
Posts: 14
Joined: Thu Mar 19, 2009 9:21 am

Material Question

Post by bruZard »

I've created a Plane:

Code: Select all

 
IMesh* mesh = context->getSceneMgr()->getGeometryCreator()->createPlaneMesh(
    dimension2d<f32>(1.0, 1.0), 
    dimension2du(u32(subDivs), u32(subDivs)), 
    mat);
    
IMeshSceneNode* plane = context->getSceneMgr()->addMeshSceneNode(mesh, parent);
plane->setMaterialFlag(EMF_NORMALIZE_NORMALS, true);
plane->setMaterialType(EMT_SOLID);
 
Now i try to change the color of the plane:

Code: Select all

 
plane->getMaterial(0).DiffuseColor.set(255, 255, 0, 0);
 
Why will this not work?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Material Question

Post by CuteAlien »

Not sure if standard fixed function pipeline can do that - diffuse lighting might need pixel-shaders.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
bruZard
Posts: 14
Joined: Thu Mar 19, 2009 9:21 am

Re: Material Question

Post by bruZard »

Why the node had a material if i can't change the color of it?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Material Question

Post by CuteAlien »

You can work with the other colors. You can experiment with the different combinations of materials and lights in the example 22.MaterialViewer.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply