[osg-users] How to get Current ContextID?

237 views
Skip to first unread message

GeeKer Wang

unread,
Jul 21, 2012, 6:08:56 AM7/21/12
to OSG-User
Hi, all

In GLUT, there is a function glutGetWindow to get the current context ID.

As far as I know, OSG get contextID for osg::RenderInfo in application. 

Are there other ways to get cureent GraphicContext ID in a thread?

--
Martin

Robert Osfield

unread,
Aug 23, 2012, 7:47:15 AM8/23/12
to OpenSceneGraph Users
Hi Martin,
All rendering code in the OSG gets passed either a RenderInfo object
which has the osg::State object for the current context or gets passed
the osg::State object directly, the osg::State has a getContextID()
method.

For none rendering code there isn't a current context so there isn't a
single ContextID that is appropriate, rather you have to decide which
active GraphicsContext in the viewer is appropriate, so just get the
windows from the viewer and then examine then for their osg::State
object and ContextID.

However, one must ask what your want the ContextID for, it's also
nothing to do with any context ID that GLUT might want to manage, the
osg::State::ContextID only has meaning with the OSG.

Robert.
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Reply all
Reply to author
Forward
0 new messages