Hi,
This post was really helpful for me but I still couldn't add points on the fly
either. A few edits made it happen so I'm attaching my M_OSG_line_strip class.
To use the class I have the following in my CreateScene()
Code:
osg::Vec3Array* line_pts = new osg::Vec3Array;
line_pts->push_back(osg::Vec3(100, 0, 0));
line_pts->push_back(osg::Vec3(0, 100, 500));
line_pts->push_back(osg::Vec3(100, 100, 100));
lines_test = new
M_OSG_line_strip(osg::Matrix::rotate(osg::inDegrees(0.0f), 0.0f, 0.0f, 1.0f),
osg::Matrix::translate(0.0f, 0.0f, 0.0f),
osg::Matrix::rotate(osg::inDegrees(0.0f), 0.0f, 0.0f, 1.0f),
line_pts,
osg::Vec4(0.0f,1.0f,1.0f,1.0f)
);
tmp_root->addChild(lines_test->Get());
and to dynamically add a new line I have
Code:
void M_frame::OnTestBtnClick(wxCommandEvent& WXUNUSED(event))
{
osg::Vec3f* new_pt = new osg::Vec3f(4000.0f, 2000.0f, 0.0f); // works
lines_test->Add_new_point(new_pt);
}
Seems to work great. Critique of the use of osg::ref_ptr is welcomed.
Thanks, Patrick
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=53984#53984
Attachments:
http://forum.openscenegraph.org//files/m_osg_line_strip_887.h
http://forum.openscenegraph.org//files/m_osg_line_strip_762.cpp
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org