[osg-users] win32 event handling

Kevin Lee kevin.lee at emiservices.com
Thu Feb 2 08:29:37 PST 2017


I'm creating a Win32 application that will have multiple graphic windows that show the same scene from different view points.  These window will be created from a main control window.

I've added an event handler to an osgViewer::Viewer.  If I use the viewer's run() member function, or put the viewer's frame() member function in a continual non-stop rendering loop, as I have seen in examples, I can receive and process mouse and keyboard events.  If I call the frame() member function just once, I don't receive the mouse and keyboard events.

1) I wouldn't mind using the run() member function, with the setRunFrameScheme(osgViewer::Viewer::ON_DEMAND) set,  if there was a way for the application to terminate the run() member function cleanly, not via the operator having to close the window.

Better yet:

2) Often I will only need to render the scene once a second or when the operator uses the mouse or keyboard to affect the scene. In this situation, I would call the frame() member function only when I need to render the scene but still be able to receive mouse and keyboard events.

Is there a way to do either one or both of the situations I described above? Or is this the wrong way entirely for what I want to do?

Thanks,

kwlee07

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








More information about the osg-users mailing list