HI Laine, It's hard to guess exactly what is going on given the details. The code itself doesn't look optimal - creating a drawable for each point isn't efficient - you should use a single osg::Geometry and just updating the vertices as you move the mouse around - when doing dyanmic updates you'll need to switch off the use of display lists via geometry->setUseDisplayList(false); or call geometry->dirtyDisplayList() when you update the geometry. So the cull traversal doesn't cull your geometry, and so the near/far clip planes get updated you'll also need to call geometry->dirtyBound() so that the bounding box of the geometry gets updated and will then be properly accounted for. Doing this may fix you problem, but as I don't really know the cause of the problem at your end it might just be a long shot - however, as it's the correct way to tackle this type of problem it's worth updating your code.
Robert. On 13 April 2012 02:14, Laine Gates <[email protected]> wrote: > Hi, > > I'm developing a 2D drawing tools , which could draw lines with mouse now. > but I encountered a problem , if want to draw a point , I had to draw two , > or draw another object together , or the first point will not show . > > the code is in Line.cpp Line:198 as follows: > > Code: > > void Line::drawAssistantPoints() > { > char name[30]; > for( int i=0 ; i<3 ; i++ ) > { > sprintf( name , "vertex_%d_%s" , i , _name.c_str()); > _assistantPoints[i]->addDrawable( drawPoint((*_vertexesArray)[i])); > _assistantPoints[i]->addDrawable( drawPoint( > (*_vertexesArray)[(i+1)%3] ) ); > _assistantPoints[i]->setName(name); > _group->addChild(_assistantPoints[i]); > } > } > > > > > '_vertexesArray' store the vertexes and middle point of the line . > > the attachment is the code. > > Now it could runs fine . > Its functions : first click with the mouse in blank space to choose a > point , second click the get the second point and configure the line . Lines > will be focusd if clicked with its vertexs and middle point lighting . > > Please anyone help me to find why the point disappeard ? > > Thank you! > > Cheers, > lainegates > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=47038#47038 > > > > > Attachments: > http://forum.openscenegraph.org//files/code_158.rar > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

