|
From: Miroslav A. <Mir...@it...> - 2009-10-26 11:25:04
|
Hello, I found out that getting the viewport pointer does only work if you call it from the draw() function but after vrj::OsgApp::draw();. Otherwise userData->getViewport(); only returns the last viewport rendered or nothing at all if you call the function in predraw(). Regarding the sceneview question I realized that multiple sceneView objects are needed if multiple windows are used. My problem was that I only used one object and if I changed the settings of that object like setting the clear color only the last window was affected by the change. Thanks, Miroslav Från: Doug McCorkle [mailto:mc...@ia...] Skickat: den 25 oktober 2009 18:12 Till: VR Juggler announcements and user questions Ämne: Re: [vrjuggler-info] Getting the current viewport using osg Hello Miroslav, On Oct 23, 2009, at 9:44 AM, Miroslav Andel wrote: Hi again, How do I get the current viewport using osg and VR juggler? Before I started to port a project from openGL to OSG I used the following piece of code: vrj::GlUserData * userData = vrj::GlDrawManager::instance()->currentUserData(); vrj::Viewport * vp = userData->getViewport(); The code above should work for OSG. VR Juggler abstracts this interface with the underlying windowing API so the code should be the same across scenegraphs and OpenGL. What is the problem you are having with the code above with OSG? I'm using each viewport's size and offset to create a 3D ray from the mouse position for picking when using multiple viewports in a window. I have looked in the programmers reference but have not found anything helpful. You can do this but you have to manage the interface between your viewports and OSG. Another question.. If multiple windows are used, configSceneView() seems only to run in the first window. If I set the clear color for example then it's only set in the first window. Is there a way to configure sceneView in a multi-window setup? What is specifically failing when you are trying to run with multiple contexts? We use this functionality of VR Juggler with OSG without many problems. I think providing more details with regards to your specific problems might be useful. Doug |