Hi Benny,
Have a look at the osgkeyboardmouse example in CVS, it has event
handler that implements mouse picking using the new
IntersectionVisitor (it replaces IntersectVisitor/PickVisitor). This
example isn't osgProducer::Viewer based, but rather uses
osgViewer::SimpleViewer just like the osgsimpleviewerQT* do so you
should be able to port the code across quite simply.
Robert.
On 12/5/06, benny porat <[EMAIL PROTECTED]> wrote:
Hi,
I build an event handler for picking and everything work fine, we do
something like that
bool KEYBOARD_EVENT_HANDLER::handle(const
osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa)
{
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::PUSH):
{
osgProducer::Viewer* viewer =
dynamic_cast<osgProducer::Viewer*>(&aa);
float x = ea.getX(); // x,y screen
float y = ea.getY();
osgUtil::IntersectVisitor::HitList benny;
if (viewer->computeIntersections(x,y,benny))
{
.
.
.
osg::Vec3 v1,v2;
viewer->computeNearFarPoints(x,y,0,v1,v2);
.
.
.
}
}
}
}
Now, I need to use GUI for my program so I use QT4, and I use Robert
example.
the problem is that the dynamic_cast return me NULL...
so I try to find intersection without the viewer, I study
osgUtil::IntersectVisitor, but there is a problem I don't know how to
convert me screen point(the one that I get from the osgGA::GUIEventAdapter).
another problem that I need to find the world coordinate of a given point
in the screen and a given z value until know I use the computeNearFarPoints
function to calculate it.
what I can do?
there is a way to work with viewer after all?
there is another way to find intersection?
there is replacement to those function that I can use?
thanks
NB
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/