Render an object with a diffuse color

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
cr_itm
Posts: 57
Joined: Sun May 01, 2005 10:13 am

Render an object with a diffuse color

Post by cr_itm »

Hello,

just a quick question: how can I render an object with just a diffuse color (and no texture)? I looked into the manual, but I only found methods to setup the material, which seems to always render at least one texture.


Thanks a lot for your help
SoulRift
Posts: 4
Joined: Sat Jun 18, 2005 11:39 pm

Post by SoulRift »

You can always make a 1x1 bitmap of the diffuse color you'd want to use :P

Here is a link to the methods you can use on a given Material via:
mesh->getMaterial(0)
http://irrlicht.sourceforge.net/docu/st ... erial.html
You may be able to get the effect you want by setting the DiffuseColor attribute to the color you want. (I'm not certain though, since I'm new at Irrlicht myself).
mesh->getMaterial(0).DiffuseColor = video::SColor(100,150,150,150)
cr_itm
Posts: 57
Joined: Sun May 01, 2005 10:13 am

Post by cr_itm »

Thanks for your help, it works.

But now there is another problem, is it possible to not set a texture for the material but set a color for an object while there is _no_ light source in the scene or in other words, I do ">setMaterialFlag(EMF_LIGHTING, false);" to deactivate lighting ?

The background of this question is the following:

I must create a scene with several simple objects (cubes). At start, I don't know how many there will be and at which position every one is. But the user must be able to set the (simple diffuse) color of the cubes.

When I now set the color with the material, it is only colored when lighting is enabled and there is a light source. But now there is the problem: I can't say, where all the cubes are, so I can't create enough light sources so every node is visible (colored).


To summarize that: Is it possible to set the color of an object (e.g. a simple cube) without all the lighting thing? If the answer is no, any idea how I can make every single object in the scene visivle without adding masses of lights?


Thanks a lot for your help!
Post Reply