I have now refactored all my view-based code so it works with
osgViewer::View's. Currently my main scene is working as it was before,
including my HUD.
However, the area I'm trying to use as a minimap is drawing itself light gray
and I have no idea why. Here is the code I'm using to initialize the minimap:
Before entering this block:
- "viewer" is an osgViewer:View that has already been added to an
osgViewer::CompositeView
- "scene" is of type osg::Node* and references the same model as my main
view...so "scene" refers to a valid scene and is non-null
- the "scene" has been added to "viewer"
Code:
// create minimap camera
osg::Camera* minimapCamera = new osg::Camera;
// setup minimap view
viewer->setUpViewAcrossAllScreens();
osgViewer::Viewer::Windows windows;
viewer->getViewerBase()->getWindows(windows);
minimapCamera->setGraphicsContext(windows[0]);
// generate dimensions for minimap
int winWidth = windows[0]->getTraits()->width;
int winHeight = windows[0]->getTraits()->height;
int displayWidth = (int)floor((float)(1920./1080 * 300));
int displayHeight = 300;
// set dimensions for minimap
minimapCamera->setViewport(winWidth - displayWidth - 20, 20, displayWidth,
displayHeight);
// set the scene for the camera
minimapCamera->addChild(scene);
// set the viewer's camera to the minimap camera
viewer->setCamera(minimapCamera);
Can anyone find anything wrong or missing from that code block?
Thanks.
Matt
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=33958#33958
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org