This is actually what I tried. The issue texture->getTextureObject(contextID) returns 0, which I assume means a null pointer?
I create my gc manually then create viewer/window etc... so my code looks like this: unsigned int contextID = gc.get()->getState()->getContextID() unsigned int textureID = texture[0]->getTextureObject(contextID)->id(); Upon executing the "textureID = " I get a seg fault, and upon further checking, texture[0]->getTextureObject(contextID) = 0. CD Skylark wrote: > Hi Conan, > > (I have the impression your name is a pseudonym, I wonder why... ;-) > > > > [dumbquestion] > > > > I am integrating some cuda into my osg app and one call requires the > > texture name/id. How do I get that from my texture object? I look through > > the source code and only found and id method in TextureObject, but my > > attempts to retrieive this bit of data eludes me. > > > > [/dumbquestion] > > > > Not a dumb question at all, part of learning how to use OSG is learning > how the things fit together and what to do to get to the information you > need... > > From an osg::Texture* (Texture2D, etc.) you have access to the > interface of osg::Texture (which Texture2D et al are subclasses of). But > first, to get to your OpenGL texture ID for a given Texture2D, you need > the context ID in which you want to get that information, which you can > get for example from the GraphicsContext like so: > > unsigned int contextID = gc->getState()->getContextID() > > Then you can do: > > GLuint textureID = texture->getTextureObject(contextID)->id(); > > to get the ID of the texture object in that context. > > Hope this helps, > > J-S > -- > ______________________________________________________ > Jean-Sebastien Guay > http://www.cm-labs.com/ > http://whitestar02.dyndns-web.com/ > _______________________________________________ > osg-users mailing list > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > ------------------ > Post generated by Mail2Forum ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43181#43181 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org