Hi Olivier,

Olivier Tournaire 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 ?

OpenSG is a fairly close wrapper around OpenGL (which is good because it gives 
flexibility, but bad as some operations are not directly/intuitively 
supported), 
so to switch to line or vertex display there are two options:

- change the type from GL_TRIANGLES to GL_POINTS or GL_LINES (for the latter 
you 
also need to duplicate some of the indices, as it uses two consecutive indices 
for a line)

- add a PolygonChunk to your Material that has FrontMode and/or BackMode set to 
GL_LINE or GL_POINT (or GL_FILL to get back). In 2 you can also put that chunk 
into a ChunkOverrideGroup to have it effect a whole subtree.

Hope it helps

        Dirk



------------------------------------------------------------------------------
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

Reply via email to