Hi,
Finally, I have a last question. Is there a way to disable the rendering of
a node. In fact, I would like to choose which are visible in my scene.
Any idea ?
Regards,
Olivier
2009/3/2 David Kabala <[email protected]>
> Hi Oliver,
>
> Yes, there is a way to do this. You will need to attach a material to this
> Geometry core that has these drawing characteristics.
>
> You will want to use a ChunkMaterial, and attach a PolygonChunk to this
> material. A polygon chunk will allow you to change the drawing mode of
> polygons to points, lines, or filled.
>
> Here is an example.
>
> #include <OpenSG/OSGChunkMaterial.h>
> #include <OpenSG/OSGMaterialChunk.h>
> #include <OpenSG/OSGPolygonChunk.h>
> #include <OpenSG/OSGLineChunk.h>
>
> //Create the PolygonChunk
> PolygonChunkPtr ThePolygonChunk = PolygonChunk::create();
> ThePolygonChunk->setFrontMode(GL_LINE);
>
> //Create a LinkChunk
> LineChunkPtr TheLineChunk = LineChunk::create();
> TheLineChunk->setWidth(3);
>
> //If you want to draw the polygon as points then you would want
> //to use PointChunk instead of LineChunk to change the
> //way points are drawn.
>
> //Create the Chunk Material
> ChunkMaterialPtr TheMaterial = ChunkMaterial::create();
> TheMaterial->addChunk(ThePolygonChunk);
> TheMaterial->addChunk(TheLineChunk);
>
> //Create your geomtry
> GeometryPtr TheGeometry = Geometry::create();
>
> //Add the Verticies, Normals, etc.
> //...
>
> //Attach the material to the Geomtry core
> TheGeometry->setMaterial(TheMaterial);
>
>
>
> Hope this helps,
> David Kabala
>
> On Mon, Mar 2, 2009 at 12:11 PM, Olivier Tournaire <[email protected]>wrote:
>
>> Hi all,
>>
>> Still in my discovery of OpenSG ... and needing some help ! I have just a
>> simple code, taken from te tutorials :
>>
>> GeometryRefPtr geo = Geometry::create();
>> GeoUInt8PropertyRefPtr type = GeoUInt8Property::create();
>> type->addValue(GL_TRIANGLES);
>> GeoUInt32PropertyRefPtr lens = GeoUInt32Property::create();
>> lens->addValue(6);
>> GeoPnt3fPropertyRefPtr pnts = OSG::GeoPnt3fProperty::create();
>> pnts->addValue(Pnt3f( 1, 0, -1));
>> pnts->addValue(Pnt3f(-1, 0, -1));
>> pnts->addValue(Pnt3f( 0, 1, -1));
>> pnts->addValue(Pnt3f( 1, 0, -1));
>> pnts->addValue(Pnt3f( 1, 0, 1));
>> pnts->addValue(Pnt3f( 0, 1, 1));
>> geo = Geometry::create();
>> geo->setTypes (type);
>> geo->setLengths (lens);
>> geo->setPositions(pnts);
>> geo->setMaterial(getDefaultUnlitMaterial());
>> // ...
>>
>> 2 triangles are properly displayed, in "plain" style. I would like to know
>> how can I change the display style, for example to have vertices or edges.
>> Is there a way to do it ?
>>
>> Best regards,
>>
>> Olivier
>>
>> --
>> Olivier Tournaire
>> MATIS - Institut Géographique National
>> 73, Ave de Paris
>> 94165 St Mandé cedex, France
>>
>> tel: (+33) 1 43 98 80 00 - 71 25
>> fax: (+33) 1 43 98 85 81
>>
>>
>> ------------------------------------------------------------------------------
>> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
>> CA
>> -OSBC tackles the biggest issue in open source: Open Sourcing the
>> Enterprise
>> -Strategies to boost innovation and cut costs with open source
>> participation
>> -Receive a $600 discount off the registration fee with the source code:
>> SFAD
>> http://p.sf.net/sfu/XcvMzF8H
>> _______________________________________________
>> Opensg-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/opensg-users
>>
>>
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users
>
>
--
Olivier Tournaire
MATIS - Institut Géographique National
73, Ave de Paris
94165 St Mandé cedex, France
tel: (+33) 1 43 98 80 00 - 71 25
fax: (+33) 1 43 98 85 81
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users