Hi Michael,
osgViewer::CompositeViewer is the appropriate tool for this type of
work, although you can use a slave camera in osgViewer::Viewer to as
well, but this isn't as logically clean. The osghud examples provide
a range of examples of use of an iscene graph camera, a slave camera,
and a separate view - its for doing a HUD but the ideas are similar.
As to why it isn't working for you, but best guess is that there is a
rendering order issue with the cameras - the full screen view
rendering after the insert view. osg::Camera has support for
specifying the rendering order, so try something like
insert_camera-setRenderOrder(osg::Camera::POST_RENDER);
You can also provide an int to setRenderOrder as a second parameter to
help differentiate between multiple post/pre draw cameras.
Robert.
On Nov 17, 2007 3:54 AM, Berg, Michael [EMAIL PROTECTED] wrote:
I'm trying to use OSG 2.2 to create a main display of the primary scene
with a smaller picture-in-picture-style display of a completely
different scene in one of the corners.
The few examples that I've found so far have been for the older OSG 1.2
(using the old Producer interface).
I initially looked at using a slave camera, but got the impression from
some mailing list postings and the API that that was for a different
view of the same scene.
Based on that and other mailing list posts, I've been trying to use the
new CompositeViewer.
I've tried running the example osgcompositeviewer executable with
every combination of the -1, -2, and -3 flags possible from the code,
but I can only ever get it to show one scene on my single display.
http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/examples/osgcompositeviewer/osgcompositeviewer.cpp
If I use completely separate windows in my code, I can get each scene to
show up in a separate windows, but this isn't what I want.
By using an osg::GraphicsContext::Traits and
view-setUpViewOnSingleScreen(0), I've been able to get one scene to
show up in only the specified portion of the monitor, but I still can't
get two scenes on the monitor at the same time.
Below is a very stripped down skeleton of the basic code I've been
working with and trying to add different osg::GraphicsContext::Traits
and Viewports too.
==
#include osgViewer/CompositeViewer
#include osgViewer/Viewer
#include osgViewer/ViewerEventHandlers
#include osgDB/ReadFile
#include osgGA/GUIEventHandler
#include osgGA/StateSetManipulator
int main (void)
{
osg::ref_ptrosg::Node cessna = osgDB::readNodeFile(cessna.osg);
osg::ref_ptrosg::Node cow = osgDB::readNodeFile(cow.osg);
osgViewer::CompositeViewer viewer;
// Main scene (fullscreen on a 1600x1200 screen)
{
osg::ref_ptrosgViewer::View view = new osgViewer::View();
view-setSceneData(cessna.get());
viewer.addView(view.get());
}
// Other scene in one corner (picture-in-picture style)
{
osg::ref_ptrosgViewer::View view = new osgViewer::View();
view-setSceneData(cow.get());
view-getCamera()-setViewport
(new osg::Viewport(0, 512, 0, 512));
viewer.addView(view.get());
}
return (viewer.run());
}
==
I've tried putting the cessna in a viewport that doesn't overlap with
the cow viewport, but I only ever see either a fullscreen cessna.
Am I one the right track, or am I completely off base here?
Any pointers on how to achieve my desired picture-in-picture view of two
separate scenes would be greatly appreciated.
- Michael Berg
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org