[osg-users] [Problem with osgLight]
Jean-Baptiste Authesserre
authesse at gmail.com
Wed Jun 18 07:01:21 PDT 2008
Hi everyone,
I have some problem with OSG Light, and I don't find answer in the osg
archives. My problem is the following : I don't understand why with the
following code my object isn't uniformly enlighten. (cf. image in attached
document)
-The black and white square of the image is centered at (0, 0, 0) (in world
frame with convention (x, y, z))
-The camera is located at (0, 0, -20)
-the light is located at (0,20, -15)
The code for activating light is the following:
/******************************* light
*************************************/
//Creation of light source
osg::Light* light = new osg::Light();
osg::LightSource * lightsource = new osg::LightSource();
lightsource->setLight(light);
// put the light source in the scenegraph
root->addChild(lightsource);
// turn light on
osg::StateSet * stateset = root->getOrCreateStateSet();
lightsource->setStateSetModes(*stateset, osg::StateAttribute::ON);
light->setAmbient(osg::Vec4d(1.0, 1.0, 1.0, 1.0));
//light->setDiffuse(osg::Vec4d(0.0, 0.0, 0.0, 0.0));
//light->setSpecular(osg::Vec4d(1.0, 1.0, 1.0, 1.0));
light->setPosition(osg::Vec4d(0.0, 20.0, -15.0, 1.0));
/******************************************************************************/
So, I don't understand why the bottom-left corner of my square is darker
than the others corners
Has anybody an Idea?
Best regards,
Jean-Baptiste.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080618/04d8cbb7/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 001.jpg
Type: image/jpeg
Size: 5237 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080618/04d8cbb7/attachment-0001.jpg>
More information about the osg-users
mailing list