Hi Art,

I got my example of ping pong working. Here is the structure

processor
|-> unitTexture (to initialize or change the input texture through the cpu)
|-> processSimulationUnitInOut (will contain the shader for the processing of 
the simulation)
|-> blurUnitInOut
|-> computeNormalsUnitInOut
|-> outputUnitInOut to get the ouput texture

(the same as writen in my first post).

Then I set an output texturet hat has the same parameters of the input texture 
to processSimulationUnitInOut with 
processSimulationUnitInOut->setOutputTexture(processSimulationOutputTexture2D, 
0);.
Then I add a osg::Camera::DrawCallback to the camera of the viewer (that is 
also the one of the processor). In the method operator() of this callback I 
extract the output texture from processSimulationUnitInOut with
osg::Texture2D* t0 = (osg::Texture2D*) 
processSimulationUnitInOut->getOutputTexture(0);
and give it to the input unit texture (unitTexture) with 
unitTexture->setTexture(t0);


One can do ping pong with several textures because of the mrt parameter of 
setOutputTexture and getOutputTexture, and it works.

I hope I was clear enough. If not, do not hesitate to ask me.

Vincent


... 


Thank you!

Cheers,
Vincent

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=32398#32398





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to