Hi Steven,

yes, you can wrap your GL texture handle with osg::Textire2D object. Here
is some snippet that might help:

<snip>
GLuint handle = ...;
        osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
        osg::ref_ptr<osg::Texture::TextureObject> textureObject = new
osg::Texture::TextureObject(texture.get(),handle,GL_TEXTURE_2D);
        textureObject->setAllocated();


texture->setTextureObject(renderInfo.getContextID(),textureObject.get());

        state.setActiveTextureUnit(textureStage);
        texture->apply( state );

        // Tell state about our changes
        state.haveAppliedTextureAttribute(textureStage, texture.get());

On Mon, Mar 16, 2015 at 6:30 PM, Steven Powers <stevenapow...@gmail.com>
wrote:

> HI!
>
> Currently I have this texture getting generated by a plugin that I'm using:
>
>         glGenTextures(1, &textureHandle);
>         glBindTexture(GL_TEXTURE_2D, textureHandle);
>         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
>         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
>         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
>         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
>         glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, N, M, 0, GL_RGB,
> GL_FLOAT, NULL);
>
> Is there an easy way to create an osg::Texture2D to use the same texture
> handle? So far it looks like textures generate their own handles. I can't
> do away with the OpenGL code.
>
> Thank you!
>
> Cheers,
> Steven
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=63113#63113
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
trajce nikolov nick
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to