Hi Marus,

Colours or lighting changing like this are normally due to the
geometry being used not having colours or normals assigned, so they
inherit the value from the last drawn geometry with a valid
colour/normal.  In your case its most likely that th base quad does't
have a colour array attached to the osg::Geometry that is used to
represent it.

See osggeometry for details about adding various vertex attributes
such as colours and normals.  Typically all osg::Geometry should have
at least a single color assigned to them.

On 6/6/07, Marcus Fritzen <[EMAIL PROTECTED]> wrote:
Hello,

it's me again ;). So now I have another problem where I could need your
help. I think you could perhaps answer it easily. Attached are two
images, the one with the red ground is the picutere "before" and the
other one "after". The Scene exists of an osg::group with two childs,
the ground geometry and the avatar. Now I just wanted to put a texture
on the avatar, what is working as you see, but why is the ground now
black??? The code I used for puting the texture image on the avatar is:

    osg::ref_ptr< osg::Group > model = new osg::Group();
    osg::ref_ptr< osg::Node > avatar = osgDB::readNodeFile(
"wholeAvatar.obj" );
    osg::ref_ptr< osg::Node > avatarPlane = osgDB::readNodeFile(
"planeAvatar.obj" );

    osg::StateSet *stateTexture = avatar->getOrCreateStateSet();
    osg::Image *imgTexture = osgDB::readImageFile( "wholeAvatar.jpg" );

    if ( imgTexture ) {
        // create a new two-dimensional texture object
        osg::Texture2D *texAvatar = new osg::Texture2D;

        // set the texture to the loaded image
        texAvatar->setImage( imgTexture );

        // set the texture to the state
        stateTexture->setTextureAttributeAndModes( 0, texAvatar,
osg::StateAttribute::ON );

        // set the state of the current geode
        avatar->setStateSet( stateTexture );

    }

    model->addChild( avatarPos.get() );
    model->addChild( avatarPlane.get() );

Thanks for your help, you are doing a good job ;)
Marcus

--
----------------------------------------------------------------
Marcus Fritzen                  E-mail: [EMAIL PROTECTED]
University Koblenz
Triererstr. 105, 56072 Koblenz,
HIWI FB4 Herr Jackel
----------------------------------------------------------------


_______________________________________________
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


_______________________________________________
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to