I thought OSG provided a call to glTexSubImage2D, similar to how it
handles glTexSubImage3D. I've since figured out that I just have to use
the regular OpenGL calls in the load and subload routines. So the
subloading is working great now.
Ken.
No problem!
What do you mean by the "missing glTexSubImage2D" issue?
biv
On 10/23/07, Sewell, Kenneth R Civ USAF AFRL/RYZW
<[EMAIL PROTECTED]> wrote:
> Thanks for all your help Gerrick. I'm past my problems setting up the
> relationship between the texture and the subload callback. I think
it's
> ready to work, assuming I can figure out the missing glTexSubImage2D
> issue.
>
>
> No problem.
> Whenever you create your texture, just set the subloadcallback:
>
> ///my texture subload callback
> class MySubloadCallback : public osg::Texture2D::SubloadCallback
> {
> public:
> void load(const Texture2D& texture,State& state) const;
> void subload(const Texture2D& texture,State& state)const;
> }
>
> ...
> ///create the texture
> osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D();
> ...
> ///create the subloadcallback
> osg::ref_ptr<MySubloadCallback> subloadCbk = new MySubloadCallback();
> ...
> ///Set the subload callback
> texture->setSubloadCallback(subloadCbk.get());
> ...
>
> On 10/19/07, Sewell, Kenneth R Civ USAF AFRL/RYZW
> <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> > Gerrick,
> >
> > If you can tolerate a few more questions...
> >
> >
> >
> > Your UpdateTextureCallback class derives from
> > osg::Texture*D::SubloadCallback, is that correct?
> >
> > What does your call to setSubloadCallback() look like? Thanks.
> >
> >
> >
> > Ken.
> >
> >
> >
> >
> > Right. I'm not sure when the subload callback is actually triggered
> but you
> > need a valid context so my first guess would be during the cull
> traversal
> > (anyone can correct me on this as I am just guessing). We derive our
> own
> > subloadCallback class that has a pointer to the texture
> > data (that's the _tm->dataField reference below). Not sure how
others
> are
> > doing it. To subload we have algorithms that trigger updating
> > the pointer to the texture data.
> > biv
> >
> >
> >
> >
> > On 10/19/07, Sewell, Kenneth R Civ USAF AFRL/RYZW <
> > [EMAIL PROTECTED]> wrote:
> >
> >
> >
> > Thanks for the response. If you don't mind could you answer a
couple
> more
> > questions?
> >
> > What triggers the callbacks? How/where is the new data to be
> subloaded
> > associated with the callback function?
> >
> >
> >
> > Thanks.
> >
> >
> >
> >
> > Hi Ken,
> > Basically you just need to setup a TextureSubloadCallback for your
> specific
> > type of texture(1D,2D,3D).
> > This allows you to override the load and subload methods that you
> would
> > encounter in gl. Then set the
> > subloadcallback to your texture using:
> >
> > Texture*D::setSubloadCallback(SubloadCallback* sb);
> >
> >
> > Overrides are something like the following:
> > load:
> >
>
////////////////////////////////////////////////////////////////////////
> ////////////
> > void UpdateTextureCallback::load(const osg::Texture3D&
> > texture,osg::State& state )const
> > {
> >
> >
>
texture.getExtensions(state.getContextID(),false)->glTexImage3D(GL_TEXTU
> RE_3D,
> > 0,
> > GL_RGBA,
> > _textureWidth,
> > _textureHeight,
> > _textureDepth,
> > 0, GL_RGBA,
> >
> > GL_UNSIGNED_BYTE,
> > (unsigned
> > char*)_tm->dataField);
> >
> > }
> > and subload :
> >
>
////////////////////////////////////////////////////////////////////////
> //////////////////////
> > void UpdateTextureCallback::subload(const osg::Texture3D&
> > texture,osg::State& state) const
> > {
> >
>
texture.getExtensions(state.getContextID(),false)->glTexSubImage3D(GL_TE
> XTURE_3D,
> > 0,
> > 0,0,0,
> > _textureWidth,
> > _textureHeight,
> > _textureDepth,
> > GL_RGBA,
> > GL_UNSIGNED_BYTE,
> > (unsigned char*)_tm->dataField);
> >
> > }
> >
> > You'll have to adjust this for your texture type (this is ours for
3D
> > textures) but this should give you a general idea.
> > biv
> >
> >
> > On 10/19/07, Sewell, Kenneth R Civ USAF AFRL/RYZW
> > <[EMAIL PROTECTED]> wrote:
> >
> >
> > Is there a good example of texture subloading in OSG? I have a
large
> > image and just want to replace small tiles of the texture. Can
> anyone
> > give me a few starting pointers?
> >
> >
> > Ken.
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> >
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
> g
> >
> >
> >
> >
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> >
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
> g
> >
> >
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> >
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
> g
> >
> >
> _______________________________________________
> osg-users mailing list
> [email protected]
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
> g
> _______________________________________________
> osg-users mailing list
> [email protected]
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org