[osg-users] osgWidget and Compositeviewer windows resize interference
Hello, I am curious to know if anyone have experience with how to make osgWidget work together with a CompositeViewer, before I try and examine the implementation in depth. I have not found anything on the forum, except for a statement saying that "it's definitely supported" (from the author I believe). I have a CompositeViewer with two views (osgViewer::View objects). They are drawing into two separate windows. I am creating an osgWidget::WindowManager, to which I provide one of my views. I then create a simple box widget, which renders in the correct position. When I resize the window, everything adjusts as expected. However, when I resize the other (non-related) window corresponding to view number 2, the widget in the first view's window scales and gets partly invisible. Is there anything that easily can be done to avoid this relation? Regards, Linus I post the example code for clarity: const unsigned int MASK_3D = 0x0F00; osgViewer::CompositeViewer* viewer = new osgViewer::CompositeViewer; // view one osgViewer::View* view1 = new osgViewer::View; view1->setName("View one"); viewer->addView(view1); osg::Node* model1 = osgDB::readNodeFile("spaceship.osg"); model1->setNodeMask(MASK_3D); view1->setUpViewInWindow(100, 100, 600, 400, 1); view1->setCameraManipulator(new osgGA::TrackballManipulator); // view two osgViewer::View* view2 = new osgViewer::View; view2->setName("View two"); viewer->addView(view2); osg::Node* model2 = osgDB::readNodeFile("avatar.osg"); model2->setNodeMask(MASK_3D); view2->setUpViewInWindow(100, 100, 600, 400, 0); view2->setCameraManipulator(new osgGA::TrackballManipulator); osgWidget::WindowManager* wm = new osgWidget::WindowManager( view1, 600.0f, 400.0f, MASK_3D); osg::Camera* cameraHUD = wm->createParentOrthoCamera(); view1->addEventHandler(new osgWidget::MouseHandler(wm)); view1->addEventHandler(new osgWidget::ResizeHandler(wm, cameraHUD)); view1->addEventHandler(new osgWidget::CameraSwitchHandler(wm, cameraHUD)); view1->addEventHandler(new osgWidget::KeyboardHandler(wm)); osgWidget::Window* box1 = createBox("HBOX", osgWidget::Box::HORIZONTAL); box1->getBackground()->setColor(1.0f, 0.0f, 0.0f, 0.8f); box1->attachMoveCallback(); wm->addChild(box1); osg::Group* group1 = new osg::Group; group1->addChild(cameraHUD); group1->addChild(model1); osg::Group* group2 = new osg::Group; group2->addChild(model2); view1->setSceneData(group1); view2->setSceneData(group2); return viewer->run(); ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Drawing problems with multi context views
Hi, I'm having problems with rendering multiple views of a scene, consisting of a terrain with PagedLODs (generated using VPB), and various other models. The problems that arise are missing textures in one or several viewports and sometimes corrupted vertex data as well. I have tested the following configurations: One CompositeViewer with multiple osgViewer::View objects. This renders fine when only a single View is attached to the CompositeViewer. When a second View is added, it will render the terrain without textures at particular parts of the terrain surface. On occasion the polygons are distorted as well. The order in which the View-objects are added to the CompositeViewer affects the result: The View that is added first to the CompositeViewer will work fine. The scene data is the same for all views. The same problems occur when using multiple osgViewer::Viewer objects instead of a CompositeViewer. I have tried to use "getCamera()->getGraphicsContext()->makeCurrent();" before frame() is called for each Viewer. I have checked that the context ID's varies among the Views. Initially the windows were based on wxWidgets, using a canvas class (inheriting from wxGLCanvas and GraphicsWindow) as graphics contexts. But the problems are the same when I simply use the Viewer's "setUpViewInWindow(.)". However, what does work is setting/creating the graphics contexts like: unsigned int contextID = osg::GraphicsContext::createNewContextID(); osg::GraphicsContext* gc = osg::GraphicsContext::getOrCreateCompileContext(contextID); m_pView->getCamera()->setGraphicsContext(gc); Does this make any sense? Since we would like to render the views inside of wxFrame-derived windows, could a canvas class (inheriting from wxGLCanvas and GraphicsWindow) be created that does the same as "getOrCreateCompileContext"? Or is there something I might be missing? Helpful for any input. Regards, Linus ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Dynamically changing all textures in a scene
Regarding the option 2: "Post process the rendering back end's osgUtil::StateGraph replacing StateSet after the cull traversal has run." Where would the point of intervention be to get access to the stategraph, in order to change the different statesets? Linus ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Dynamically changing all textures in a scene
Ok, switching every stateset would be what I am looking to do. Composing the texture in the shader would mean we loose the desired ability to use image files. Linus ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Dynamically changing all textures in a scene
Hi, I would appreciate some advice on how to best use the osg functionality, in order to be able to dynamically change every single texture in a scene, depending on the view. Every view in the scene should have the possibility to either use original textures or alternative (infrared) versions. An approach where we do not have to use switches between duplicate scenes would be preferred. Greatful for any ideas. Regards, Linus Hilding ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PagedLOD traversal problem after switch to 2.6.1
Sorry for the shorthanded info. Since we changed nothing other than osg version, we where curious to know if we made som known mistake. A switch back to version 2.2.0 will make it work again. When we draw the scene, the draw traversal has no trouble finding the different PagedLOD children, but prior to that a scene->traverse(visitor) on the root with a visitor derived from NodeVisitor with _TraversalMode set to osg::NodeVisitor::TRAVERSE_ALL_CHILDREN, and apply() functions that continue the traversal, will not reach all the children that keeps the different LOD levels. But we will continue debugging and get back if we have a more specific question of relevance. Regards, Linus and Ragnar ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] PagedLOD traversal problem after switch to 2.6.1
We have a scene graph in which we want to make changes to every node's state set (switching textures). The scene graph consists of several nested PagedLOD objects(quad structure). After updating to OSG 2.6.1 from 2.2.0, not every LOD level gets visited by our NodeVisitor, when applied to the tree. Does anyone have any idea of what might be the problem? Regards Ragnar and Linus ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org