HI Michale,

The ContextID is associated with GraphicsContext's, and its the
Viewer's Camera's that hold the GraphicsContext (normally a
GraphicsWindowsX11/Win32/Carbon subclass), and each GraphicsContext
has the State object, each of which has the ContextID so on can do:

  viewer.getCamera()->getGraphicsContext()->getState()->getContextID();

Or if the viewer's master Camera doesn't have a GraphicsContext,
instead it delegates the rendering to its slaves then you'll need to
iterator through the slave Camera's to get the ContextID.  There is a
viewer.getContexts(osgViewer::ViewerBase::Contexts&) convinience
method to help you get the lists of all the active graphics contexts,
so you could easily use this instead of iterating through.

And... not once did you need to grapple with the internal
implementation of SceneView that is used the hood.  But if you really
really must grapple then the Camera::getRenderer() will give you the
Renderer that is used to do the rendering - and its this
osgViewer::Renderer that has the SceneView that does all the internal
work.

Robert.

On Dec 13, 2007 9:52 PM, Michele Bosi <[EMAIL PROTECTED]> wrote:
> Hello,
> I need to retrieve the current contextID or the contextID that a
> Viewer is working on, how do I do it?
> I saw in the documentation that one should retrieve the SceneView but
> it doesn't say how / from where, and I couldn't
> figure it out, as far a I could see osg::View and its subclasses
> doesn't have such a getSceneView() method
> or similar. I saw that there were some posts about how to retrieve the
> context from a camera but that seemed
> to be more of an hack than the actual "standard" way so if possible I
> would like to avoid that solution.
> So, what is the clean and mean way of retrieving the SceneView given
> an osgViewer::Viewer?
>
> Regards,
> Michele
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to