Hi! (I'm new to all this OSG stuff...)

I'm trying to implement some basic HDR tone mapping using FP (GL_RGBA16F_ARB) textures in OSG. It is a multi-pass shader based technique, I draw the scene, do a bunch of luminance calculations and end up with a 1x1 texture that is the average scene luminance. As a part of the tone mapping I am trying to do adaptive tone mapping so changes gradually happen over a duration of time, this is done by slowly adapting the average luminance between frames.

So at some point in each frame I have the scene luminance for the current frame. I input that, plus the adapted scene luminance from the last frame to a shader that calculates the proper adapted average luminance for this frame...

Now what I am trying to do is copy that resulting texture over to the 'old' texture reference so that next frame it will be the old texture that is passed in...but its not working! Regardless of how I'm doing multi-pass stuff, building a simple quad and texturing it with either the current/unadapted frame luminance or the adapted frame luminance works, but the adapted frame luminance texture from last frame is nowhere to be found suggesting that my texture copying isn't working...

All I am doing is something like this

(Global)
osg::ref_ptr<osg::Texture2D> oldTex;
osg::ref_ptr<osg::Texture2D> adaptTex;

...
[Tons happens, adaptTex is initialized, gets used as a render target and works as it can be drawn to a quad and looks fine]
...

In while(!mViewer.done()):

oldTex = new osg::Texture2D(*(adaptTex.get()), osg::CopyOp::SHALLOW_COPY);
adaptPassStateSet->setTextureAttributesAndModes(1, oldTex.get());

and as I said adaptTex looks fine when pasted on a quad, but oldTex doesn't seem to be there. I've tried other CopyOps from DEEP_COPY_IMAGES to DEEP_COPY_ALL. But this texture just never seems to get copied...whats up?

I'm sure making a whole new texture each frame isn't the most efficient way of doing this, but I'm just trying to get my proof of concept working and I am stuck on simply cloning a texture in OSG.

Jon
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to