Hello Olivier,

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

the appearance of geometry is determined by its material and normally a 
material is composed of a number of chunks (each of these wraps a bunch 
of related OpenGL state).
To get only lines or points you need a PolygonChunk:

PolygonChunkRefPtr pc = PolygonChunk::create();
pc->setFrontMode(GL_LINE);

MaterialRefPtr mat = geo->getMaterial();
mat->addChunl(pc);

Note however that if you add this to the above code you will modify the 
system DefaultUnlitMaterial (because that is what you assigned to the 
geometry). You may want to create your own material and modify that instead.

        Cheers,
                Carsten






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