shouldn't MaterialGroups solve this problem? Sajjadul could then use the same geometry core below the two different MaterialGroups. As the material higher up in the graph overides the ones below it, it should't event matter if the geometry still has is its own material. Am I wrong?
So what I am suggesting is: Having a switch with two MaterialGroups as children, containing the two different shaders as material. These two have each a Node as child with the same geometry as a core. Switching then should use different materials while the used geometry is the same.
Otherwise I think Sajjadul would need a deep copy of the geometry core. Else the copy shares the material with the original geometry. Do I understand something wrong?
Kind regards,
Bjoern Zehner
----- Ursprüngliche Nachricht -----
Von: Sajjadul Islam <[EMAIL PROTECTED]>
Datum: Donnerstag, 6. März 2008, 2:46
Betreff: [Opensg-users] Using Switch Node with the key press event
An: OpenSG Users <[email protected]>
> Hello Carsten,
>
>
> Thanks for the hint.
>
> As you have suggested to make the shallow copy i tried that and
> came up with the following error:
>
> mainShader.cpp: In function 'osg::NodePtr createSceneGraph()':
>
> mainShader.cpp:346: error: conversion from
> 'osg::FieldContainerPtr' to non-scalar type
> 'osg::FCPtr<osg::FCPtr<osg::FCPtr<osg::FCPtr<osg::AttachmentContainerPtr, osg::NodeCore>, osg::Drawable>, osg::MaterialDrawable>, osg::Geometry>' requested
>
> make: *** [mainShader.o] Error 1
>
> In the OpenSG i found another code posted by Dirk, i tried
> that and it worked , but i wonder if the one you suggested is
> the same as Dirk's
>
> NodePtr utah_teapot2 =
> OSG::cloneTree(utah_teapot1);
>
>
> The function that is posted by dirks seems to share the node core and creating a new Node.
>
>
> I am not sure what procedure would be efficient to render the same geometry(utah teapot in my case ), with different shader(which is a material property)
>
> and i would like to render the same geometry with different material property that will be selected with the key-press event.
>
>
> Can you suggest anything based on performance and memory efficiency?
>
>
> Cheers,
>
>
> Sajjad
>
>
>
>
>
> > -----------------------------------------------------------------
> --------
> 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
-------------------------------------------------------------------------
Dr. Bjoern Zehner
UFZ Centre for Environmental Research Leipzig-Halle
Permoserstrasse 15
04318 Leipzig
Germany
http://www.ufz.de/index.php?en=5673
Tel: ++49 (341) 235 3979
Fax: ++49 (341) 235 3939
------------------------------------------------------------------------- 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
