Hi Sukender, If you are manage OpenGL objects outwith the OSG then it would probably be best to write your own custom osg::Texture subclass that does the appropriate OpenGL code for handling your objects.
Robert. On 3 August 2012 11:38, Sukender <suky0...@free.fr> wrote: > Hi all, > > Do you know a way of creating an osg::Texture2D witch will have a given > OpenGL ID? My goal is to "overwrite" an existing (external) texture. And of > course the only thing that I know is the ID (and a few parameters). I tried > the following code: > > osg::ref_ptr<osg::Texture2D> tex( new osg::Texture2D(image.get()) ); > osg::Texture::TextureProfile profile(GL_TEXTURE_2D, numMips, > internalFormat, width, height, 1, 0); > osg::ref_ptr<osg::Texture::TextureObject> to(new > osg::Texture::TextureObject(tex.get(), textureId, profile)); > to->setAllocated(true); > tex->setTextureObject(contextId, to.get()); > > osg::ref_ptr<osg::State> state( new osg::State ); > state->setContextID(contextId); > tex->apply(*state); > > > Unfortunately this doesn't seem to work. Moreover, I have another issue with > this code: I must delete the osg::Texture2D object WITHOUT deleting the > corresponding OpenGL texture... > Any idea? > > Thanks. > > Cheers, > > Sukender > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org