Hi did you call viewer.realize() before attempting to get contextID from it?
Cheers. 20.08.2012, 20:27, "Jeremy Moles" <[email protected]>: > Hello everyone! I have a bit of a strange question here, so please bear > with me. I'll try to be as descriptive as I possibly can, though I'm > certain I will misuse some terminology. > > I am adding support for the NV_path_rendering extension to > OpenSceneGraph. This extension adds a number of new functions to OpenGL > when using an NVidia card which take on the form: > > glPath{_function_}NV > > http://osgnvpr.googlecode.com > > In order to create pointers to these new extension functions, I create > an Extensions object in OSG using the contextID given to me during the > compileGLObjects method of my overridden Drawable class. This works > fine, and the code is running as I expect. > > https://code.google.com/p/osgnvpr/source/browse/trunk/src/PathCommands.cpp#45 > > HOWEVER, this paradigm really only works when I need to call extension > functions associated with an instance (or instances) of my Drawable. > There are other functions in the NV_path_rendering API that simply set > global state, and it is with these functions that I'm having difficulty. > > The biggest problem here is that in order to get a pointer to the > Extensions static object, I need a valid GraphicsContext contextID. > However, I've tried a number of methods to obtain one of these, but > every attempt I make actually breaks the entire codebase. I wish I could > explain it better than that... > > For example, if I try to use some code like the following: > > ------------------------ > > Windows windows; > > viewer.getWindows(window); > > cID = windows[0]->getState()->getContextID(); > > osgNVPR::getNVPRExtensions(cID); > > ------------------------- > > ...then I seem to get an invalid contextID and all subsequent attempts > to use that contextID (even by OSG itself) won't work. The entire > rendering process seems to be broken in this manner. > > If instead I create a Camera::DrawCallback object and use the RenderInfo > there instead, then everything works fine. However, I feel like I'm > grossly misusing a Camera::DrawCallback just to set and unset state... > > My question is: if I need to set global state like this once, somewhere > high in the scenegraph, what is the best way--keeping in mind that I > also need a valid contextID in order to access my Extensions functions > per-context? > > Thanks! > > _______________________________________________ > 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

