Event between OSG and VRJuggler and my custom widget.

73 views
Skip to first unread message

김명재

unread,
Jul 21, 2013, 6:21:14 AM7/21/13
to vrjuggler...@googlegroups.com
I want to develop osg-based widget library which can be used on vrjuggler.
(It means, library has to be encapsulated very well)

As an example, RectButton class has to be encapsulated properly with various event such as mouseClicked, keyDown, keyUp, mouseOver, and so on(Events are just examples).
But whatever input device is, device input events are received by vrjuggler as long as vrjuggler holds kernel, I can't add any eventhandler on my library because vrjuggler uses SceneView, not Viewer.
(Actually, even if vrjuggler uses Viewer, add eventHandler is manual still)


After some surf, I found AppViewer class and although it uses Viewer, I added this code in bufferPreDraw()

(I'm modifying AdvancedOSGNav example)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
osg::ref_ptr<osgViewer::Viewer> contextViewer;
contextViewer = (*mContextViewer);
contextViewer->addEventHandler(ctrler.get());
contextViewer->getCamera()->setViewMatrixAsLookAt(
osg::Vec3(0.0f, -100.0f, 0.0f), osg::Vec3(), osg::Z_AXIS);

ctrler is an instance of my custom class which inherits GUIEventHandler in which overrides handle() method.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

But it gives this error -> 

Warning: detected OpenGL error 'invalid value' at after RenderBin::draw(..)

I can still see cow.osg model and vrjuggler keys(which are defined in standalone.jconf file) are still working.
But it seems like code doesn't come into overrided handle() method because I toggled breakpoint in it, but code doesn't stop when debugging.

All other code are not modified from original one except upper code.

My questions are

1. What is the problem with my situation? (Viewer case [vrj::osg::AppViewer)
2. Is there any good idea to make well-encapsulated and event-handled widget library (like .net, MFC, QT etc.) in this vrjuggler+OSG system using SceneView (vrj::osg::App)?

Thank you in advanced.

Doug McCorkle

unread,
Jul 21, 2013, 8:22:19 PM7/21/13
to vrjuggler...@googlegroups.com
Hello,

I am not aware of an easy way to do this using the osgWidget tools. The osgWidget tools are tightly coupled to an Ortho 2D projection with interaction from the mouse. I recently tried to use a derived osgWidget class driven by tracking positional data and it was a horrible experience. That particular application was also an osgViewer based application and it was still a pain. It would be even more difficult with VR Juggler in the mix. I think the most straight forward way to do this in a VR Juggler application is to manage your own widgets. To use another widget library with VR Juggler would generally require you to derive a Widget based context that VR Juggler can use in the OpenGL or DirectX draw managers. In general this is not a straight forward problem to resolve with VR Juggler.

The GUIEventHandler is not setup that well to integrate with VR Juggler's gadgeteer. The gadgeteer tools are fairly general but the GUIEventHandler would have to be driven within a vrj::app event methods like latePreFrame and such based on the ipute received through gadgeteer.

Doug
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "vrjuggler-questions" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vrjuggler-quest...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Reply all
Reply to author
Forward
0 new messages