Hi,

I can't see anything obviously wrong, can you make a small example that breaks?

jp

On 02/06/11 13:28, Sergey Alekseev wrote:
Hi,

I haven't got an answer to my question in topic "best way to draw a tube", so I 
try to make new thread.

I'm drawing top and bottom rings of tube as polygons. I calcucate vertices of 
polygons according to outer radius of the tube and thickness of it's wall. I'm 
using DrawElementsUShort for specification of order of the vertices.
But the code below gives an memory access violation error.

10 osg::Geometry * polyGeom = new osg::Geometry ();
11 polyGeom ->  setVertexArray (vertices);
12 osg::DrawElementsUShort * elements = new 
оsg::DrawElementsUShort(osg::PrimitiveSet::QUAD_STRIP);
13 //elements ->reserve (40);
14 for ( unsigned int i = 0; i<  40;  i ++ )
15      elements ->  push_back (i);
16      //elements [i] = i;
17 polyGeom ->  setNormalBinding (osg::Geometry::BIND_OVERALL);
18 polyGeom ->  addPrimitiveSet (elements);
19 item ->  addDrawable (polyGeom);

This error appears at 2nd iteration of cycle in string 15. This result appears 
in standard example provided with library, too.
The size of vector elements already after inizialization is really huge, it's 
clearing or size change gives nothing.

Tell me please, where I'm wrong.

If I use DrawArray instead of DrawElementsUShort, the central part (inner 
diameter of a tube) paints with color - the circle's half is drawing instead of 
ring's half.

Thanks.

Cheers,
Sergey

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=40033#40033





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to