[osg-users] Texture subloading

Robert Osfield robert.osfield at gmail.com
Fri Oct 19 11:37:30 PDT 2007


Hi Ken,

The callback is called on every frame, the callback is then
responsible for check to see if the subload is required.  At least
that's what I remember, its about 5 years since I wrote or used the
code :-)

Robert.

On 10/19/07, Sewell, Kenneth R Civ USAF AFRL/RYZW
<Kenneth.Sewell at wpafb.af.mil> 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_TEXTURE_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_TEXTURE_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
> <Kenneth.Sewell at wpafb.af.mil> 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
>  osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>



More information about the osg-users mailing list