Hello all,

  I realize that OSG has long since deprecated support for Producer::Viewer in 
favor of the Viewer class, but I am hoping that someone might be able to point 
me in the right direction.. 

  I am working on updating a display that use OSG 0.9.9 (and for other support 
reasons we can't reasonably upgrade to the latest version). We use the 
following code to create a viewer and attach a NodeTrackerManipulator object 
called "CameraTracker" to track events with a plane node.


Code:

MyCode::initializeViewer()
{
osgProducer::Viewer* viewer; 

viewer->setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS);

//perform other setup

nodeTracker = new CameraTracker();

unsigned int num = viewer->addCameraManipulator(nodeTracker);
viewer->selectCameraManipulator(num);
...
viewer->realize();
}

//NodeTrackerManipulator that handles mouse events
bool CameraTracker::handle(const GUIEventAdapter& ea,GUIActionAdapter& us)
{

_thrown = false;
switch(ea.getEventType())
{
case(GUIEventAdapter::PUSH):
{
flushMouseEventStack();
addMouseEvent(ea);
if (calcMovement()) us.requestRedraw();
us.requestContinuousUpdate(false);
_thrown = false;
return true;
}
}
}





The NodeTracker object receives events correctly in the initial implementation, 
but I have recently added a simple line of code to embed
the OSG Display inside an MFC dialog window:


Code:

if(m_mfcParentWndHandle != NULL)
{
//Attach OSG viewer display to an existing MFC dialog frame using HWND
viewer->getCameraConfig()->getCamera(0)->getRenderSurface()->setWindow(m_mfcParentWndHandle);
...
viewer->realize();
}




This new code segment attaches the display to the MFC parent correctly, and 
FRAME events still seem to be processed (so the display can be redrawn on 
frame()), but my NodeTrackerManipulator class doesn't receive mouse events 
anymore. 

I've looked at the old OSGMFC example, but it doesn't seem to address this 
particular situation. I've also tried capturing the MFC mouse events in the 
parent dialog, but I can't figure out how to create new GUIEventAdapter objects 
that can be passed to my "handle" function.

Does anyone with knowledge of MFC or this old implementation have a suggestion 
as to where to look next? 


Thanks,
John

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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to