Re: [osg-users] osg::DrawElements - i missed something?

2010-10-28 Thread Robert Gosztyla
Hi,

I have no errors, just version using draw elements is not displayed. I'm using 
VC2008 Express under Vista64 on GF9800GT. Are there any limitations using draw 
elements i should know about?

Thank you!

Cheers,
Robert

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





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


Re: [osg-users] osg::DrawElements - i missed something?

2010-10-28 Thread Robert Gosztyla
Hi,

I have found one interesting behaviour yet:

osg::ref_ptr  osg::UIntArray array = new osg::UIntArray();
array-push_back( 0 );
array-push_back( 1 );
array-push_back( 2 );
array-push_back( 3 );
p_geometry-addPrimitiveSet( new osg::DrawElementsUInt( 
osg::PrimitiveSet::TRIANGLES, array-size(),  array-front() ) );

And it works. But anybody have any idea what was wrong before?
Thank you!

Cheers,
Robert

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





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


[osg-users] osg::DrawElements - i missed something?

2010-10-27 Thread Robert Gosztyla
Hi,

Small piece of code:


Code:
osg::ref_ptr  osg::Vec3Array  verts = new osg::Vec3Array();

verts-push_back(osg::Vec3(-100.0f, 200.0f,-100.0f ) );
verts-push_back(osg::Vec3( 100.0f, 200.0f,-100.0f ) );
verts-push_back(osg::Vec3( 100.0f, 200.0f, 100.0f ) );
verts-push_back(osg::Vec3(-100.0f, 200.0f, 100.0f ) );
verts-push_back(osg::Vec3(-100.0f, 200.0f,-100.0f ) );

osg::ref_ptr  osg::DrawElements  elements = static_cast  osg::DrawElements* 
 ( new osg::DrawElementsUInt( osg::PrimitiveSet::LINE_LOOP ) );

elements-reserveElements( 3 );
elements-addElement( 0 );
elements-addElement( 1 );
elements-addElement( 2 );

p_geometry-setVertexArray( verts.get() );

// does not work
p_geometry-addPrimitiveSet( elements.get() );

// works
p_geometry-addPrimitiveSet( new 
osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,verts-size() ) );

p_geode-addDrawable( p_geometry.get() );



Do you see something wrong in this code? Or I missed something?

Thank you!

Cheers,
Robert

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





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


Re: [osg-users] osg::DrawElements - i missed something?

2010-10-27 Thread Wang Rui
Hi Robert,

DrawElementsUInt can make use of std::vector methods directly, such like:

osg::DrawElementsUInt* de = new
osg::DrawElementsUInt(osg::PrimitiveSet::LINE_LOOP);
de-push_back( 0 );
de-push_back( 1 );
de-push_back( 2 );

Or

de-resize(3);
(*de)[0] = 0;
(*de)[1] = 1;
(*de)[2] = 2;

Just have a try. :-)

Cheers,

Wang Rui


2010/10/27 Robert Gosztyla robert.goszt...@gmail.com

 Hi,

 Small piece of code:


 Code:
 osg::ref_ptr  osg::Vec3Array  verts = new osg::Vec3Array();

 verts-push_back(osg::Vec3(-100.0f, 200.0f,-100.0f ) );
 verts-push_back(osg::Vec3( 100.0f, 200.0f,-100.0f ) );
 verts-push_back(osg::Vec3( 100.0f, 200.0f, 100.0f ) );
 verts-push_back(osg::Vec3(-100.0f, 200.0f, 100.0f ) );
 verts-push_back(osg::Vec3(-100.0f, 200.0f,-100.0f ) );

 osg::ref_ptr  osg::DrawElements  elements = static_cast 
 osg::DrawElements*  ( new osg::DrawElementsUInt(
 osg::PrimitiveSet::LINE_LOOP ) );

 elements-reserveElements( 3 );
 elements-addElement( 0 );
 elements-addElement( 1 );
 elements-addElement( 2 );

 p_geometry-setVertexArray( verts.get() );

 // does not work
 p_geometry-addPrimitiveSet( elements.get() );

 // works
 p_geometry-addPrimitiveSet( new
 osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,verts-size() ) );

 p_geode-addDrawable( p_geometry.get() );



 Do you see something wrong in this code? Or I missed something?

 Thank you!

 Cheers,
 Robert

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





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

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


Re: [osg-users] osg::DrawElements - i missed something?

2010-10-27 Thread Robert Gosztyla
Hi,

Hmm, the same effect, doesn't work (why should?). There is something wrong with 
elements-addElement() method?

Thank you!

Cheers,
Robert

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





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


Re: [osg-users] osg::DrawElements - i missed something?

2010-10-27 Thread Wang Rui
Hi Robert,

In fact both your code and mine work fine under my platform. It is OK to use
addElement(), too and a triangle line (made up by the first three elements
in the vertex array) will appear. Is there something wrong with your
makefile or project settings? What is the error message?

Cheers,

Wang Rui

2010/10/28 Robert Gosztyla robert.goszt...@gmail.com

 Hi,

 Hmm, the same effect, doesn't work (why should?). There is something wrong
 with elements-addElement() method?

 Thank you!

 Cheers,
 Robert

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





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

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