[osg-users] wrapping an externally generated OpenGL texture in an osg::Texture ?

Christian Buchner christian.buchner at gmail.com
Fri Nov 6 08:57:34 PST 2015


Hi,

I have some legacy OpenGL code that is integrated with our OSG based
application. This code creates and updates its own textures using OpenGL
API calls and we are using a custom drawable with a drawImplementation()
that binds said textures with OpenGL API calls before rendering the
geometry. We have to be quite careful about saving and restoring the OpenGL
texture states and this works reasonably well.

Now I would like to use the textures generated by the legacy code on some
newly created OSG nodes and geodes. Preferably I would like to wrap the
OpenGL texture IDs into instances of osg::Texture2D and osg::TextureObject
classes. I intend to attach the textures to an osg::StateSet (no custom
draw implementations shall be required).

Is there any prior art or examples showing how to instantiate
osg::TextureObject/Texture2D objects from externally generated OpenGL
texture IDs? Is this even possible without breaking anything?

Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20151106/619b863b/attachment-0002.htm>


More information about the osg-users mailing list