Hi Eric, It's a long time since I looked at the subload callback. Having the load and subload methods available in osg::Texture2D seems like a sensible option.
However, it might be that you don't need the callback at all. Have you looked at the osg::Image::Image::readImageFromCurrentTexture(..) method? Robert. On 6 March 2015 at 19:50, Eric Sokolowsky <[email protected]> wrote: > I have need for some custom code to run after the > Texture2D::applyTexImage2D_subload function is called. (I am reading back > the image from OpenGL, which might have been compressed by the graphics > card, and saving it to disk.) So I have been using a subloadCallback to put > the custom code in place. This works, but I don't require any custom code > for the Texture2D::applyTexImage2D_load function. But since the > subloadCallback requires me to implement both the load and the subload I > must do both. But I can't replicate the code in Texture2D::apply in my > subloadCallback because there are lots of mutable members in Texture2D and > getting them from the subloadCallback doesn't make them mutable for me, so > I get lots of errors of losing constness and qualifiers if I try this path. > > So I am wondering how best to proceed from here. Should I derive a class > from Texture2D so I can intercept calls to apply(), then call the base > class version and do my custom processing from there, or can we add a hook > to call a custom callback after the Texture2D::applyTexImage2D_load and/or > the Texture2D::applyTexImage2D_subload functions? > > Or is there a better way to read the texture back from the graphics card > that is independent of the Texture2D::apply function? Of course this will > need to be done in the draw thread. > > Any help will be appreciated.. > > Eric > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

