[Plib-users] Light & material problem
Brought to you by:
sjbaker
|
From: P.GILARDETTI <p.g...@li...> - 2003-01-31 15:34:51
|
Hi,
I'm a newbie, I have a problem because I load a dxf model that is black
and hasn't a texture.
I want to associate some settings about material to this model and I don't
know how to do.
I load the model with the code:
scene = new ssgRoot();
model = new ssgTransform();
ssgEntity *obj = ssgLoad ( filename );
model -> addKid(obj);
scene -> addKid(model);
Then I set the state of the model with:
state = new ssgSimpleState();
state -> setShadeModel(GL_SMOOTH);
state -> enable(GL_CULL_FACE);
state -> enable(GL_BLEND);
state -> enable(GL_LIGHTING);
state -> setColourMaterial(GL_AMBIENT_AND_DIFFUSE);
state -> setMaterial(GL_EMISSION, 0, 0, 0, 1);
state -> setMaterial(GL_SPECULAR, 1, 1, 1, 1);
state -> setShininess(4);
Then I would illuminate the 3d model, should I specify the normal for each
vertex of the model or can I only use the following statement?
sgVec3 sunpos;
sgSetVec3(sunpos, 10.0f, 10.0f, 10.0f);
ssgGetLight(0) -> setPosition(sunpos);
Thanks,
Paolo Gilardetti
|