> Hi Paul, > > The contextID is stored in the osg::State, SceneView has a > State and therefore the ContextID. The osg::Camera without > any graphics context doesn't though as its through the > GraphicsContext that it gets its State. > > Workarounds for you would be to create a dummy > GraphicsContext for each window that the apps opens and make > this GraphicsContext share the SceneView's State. > Alternatively you could have a hack where you register a > callback to get the contextID given a Camera, then an > application specific custom callback could implement a > mapping between the Camera and the appropriate SceneView and > then finally to the ContextID. > > Robert.
Thanks, these are good suggestions, and I believe I can find a workaround quite easily. However, my post below expressed concern that there was no way to access the current contextID at a global level. There's no equivalent of glXGetCurrentContext in OSG, for example. It seems like, if a context is current in the active thread, OSG should provide a global method for obtaining its contextID, analogous to what GLX, WGL, AGL, etc., all provide...? -Paul > > On Dec 11, 2007 7:18 PM, Paul Martz <[EMAIL PROTECTED]> wrote: > > > > > > Hi Robert -- I'm working with an older app that deals directly with > > SceneView. It effectively creates its own window and > manages its own > > graphics contexts. > > > > I've found this app doesn't work with osgOQ. osgOQ uses a > Camera post > > draw callback to retrieve the query results, and therefore > needs the > > abstract unsigned int contextID. To get this, it uses the > following code: > > camera.getGraphicsContext()->getState()->getContextID(). > > > > The only problem is that the app never set up a > GraphicsContext on the > > SceneView's Camera. SceneView doesn't do this itself (of course -- > > it's ignorant of contexts). > > > > Note that osgOQ can get the contextID just fine in other > parts of the > > code, such as in a CullVisitor traverse() call, or in a > draw callback > > or drawImplementation(). The contextID is readily available from > > RenderInfo::getState(). It's just the Camera post draw > callback that > > is the problem, because I must go through the Camera's > (non-existent) > > GraphicsContext to get State. > > > > It seems like, somewhere, there should be a mapping of > actual platform > > rendering context IDs to OSG's abstract unsigned int > contextID, such > > that, if a context is actually current, code should be able > to look up > > the abstract unsigned int contextID in a map somewhere. I've been > > unable to locate any such construct in OSG. > > > > I'm certain you'll recommend porting to osgViewer, but telling my > > client that the previously-supported OSG interface they coded to is > > incompatible with osgOQ isn't really an option. So, if > there's no way > > for me to get a contextID from a Camera that doesn't have a > > GraphicsContext, then I'll have to look into alternate > implementations for osgOQ. > > > > Paul Martz > > Skew Matrix Software LLC > > http://www.skew-matrix.com > > 303 859 9466 > > > > _______________________________________________ > > 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-opensce negraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

