Hello Sajjadul,
Sajjadul Islam wrote:
> Hello Björn,
>
> I did the necessary changes as suggested, unfortunately i am getting the
> blank screen.
>
> So i am providing you the code snippet where i defined the main scenegraph:
>
> *******************************************************************************
[SNIP - loading code]
>
> //the getCore method returns the CoredNodePtr,
> //which all other pointer classes derived from
> GeometryPtr geoUtah1 = GeometryPtr::dcast(utah_teapot1->getCore());
>
> /*
> Now create the material
> for that for that geometry
> inside the function createToonScene() - i m creating the shader chunk
> */
> beginEditCP(geoUtah1, Geometry::MaterialFieldMask);
> geoUtah1->setMaterial(createToonScene());
> endEditCP(geoUtah1, Geometry::MaterialFieldMask);
>
> /*
> Set the geometry to
> the node that we have
> just read
> */
> beginEditCP(utah_teapot1, Node::CoreFieldMask);
> utah_teapot1->setCore(geoUtah1);
> endEditCP(utah_teapot1, Node::CoreFieldMask);
this is not necessary, since you get geoUtah1 as the core of
utah_teapot1. Just getting a Ptr to something does not create copies of
that something; is that what you wanted ?
> GeometryPtr geoUtah2 = GeometryPtr::dcast(utah_teapot1->getCore());
>
> /*
> Now create the material
> for that for that geometry
> */
> beginEditCP(geoUtah2, Geometry::MaterialFieldMask);
> geoUtah2->setMaterial(createPhongScene());
> endEditCP(geoUtah2, Geometry::MaterialFieldMask);
since geoUtah2 points to the same core as geoUtah1 you just overwrite
the Material you set earlier.
You need a new Geometry core that shares all the properties (not
strictly required, but otherwise you waste memory) but has a different
Material. One way to get that copy is:
GeometryPtr geoUtah2 = geoUtah1->shallowCopy();
[SNIP - remaining code]
Hope it helps,
Carsten
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users