[osg-users] Equivalent of glTexSubImage2D ?

Robert Osfield robert.osfield at gmail.com
Tue Feb 28 09:25:55 PST 2017


On 28 February 2017 at 12:04, Johny Canes <psijsma at gmail.com> wrote:
> Hi,
>
> Mh Robert, it seems glTexSubImage2D is the most straightforward. I don't want to build an abstraction around one simple operation.
>
> There's a couple of things now. Can I or may I manually bind using
> Code:
> texture->getTextureObject( cid )->bind();
>
>  or alternatively, directly with
> Code:
> glBindTexture( GL_TEXTURE_2D, tid );
>
> ?

You should see the same result, the bind() call will just be doing a
glBindTexture call itself.  Going dig into the source code to see what
it's doing.

The advantage of using TextureObject is that you can leverage the
OSG's ability to recycle textures objects and have them cleaned up
reliably.  Recyling texture objects is really important when doing
paged scenes as creating and destroying GL objects is very expensive
relative to just subloading data.  The OSG does this automatically for
you.

In your case you want to do subloading of portion of an image which
steps beyond what the core OSG provides, but texture objects and reuse
might still be important.

Robert.



More information about the osg-users mailing list