Hi,

also have a look at this thread:

http://article.gmane.org/gmane.comp.graphics.openscenegraph.user/26257/match=runcamerasetup

If you want to change the attachments after camera is created, you must 
somehow force runcamerasetup to be called. This might be slow.

I still think that a shader might be the best solution. You attach your 
2 textures as both input and output (using multiple render targets). 
Then between frames you just switch the values of the uniforms pointing 
to the right input and output. e.g.

--8<--
shader:
uniform input_tex;
uniform output_tex;

read from input using sampler
do stuff
write to output using glFragData[output_tex]
--8<--
cpp code:
frame 0: set input uniform to 0, output to 1
frame 1: set input uniform to 1, output to 0
...

hope this helps

regards
jp



Roman Grigoriev wrote:
> Thanx for your reply but I need to explain what I want.<неиI've seen
> stereomatch but I need to implement another thing.<неиI try to explain. So I
> try to make clouds rendering on GPU using cellular automata.<неиSo initial
> states are in texture1 and using FBO, attached to texture2 and pixel shader,
> I calculate states and write it to FBO texture2.<неиSo now for this steps
> initial steps are in texture2 and here is the main question how can I
> "disapply" texture2 from FBO and apply to texture1.<неиIn OSGPPU it was made
> by copying to additional texture so there is no any discomfort to
> programmer. But this trick need to use additional pass <неиIn my case
> copying 2048*2048 textures can take very long time. so I need dynamically
> change FBO - tex1,nextframe-tex2,nextframe-tex1,nextframe-tex2.<неиThe main
> problem that FBO statically applying when you create camera and in current
> OSG you can't dynamically change FBO attachment.<неиSo I'm newbie in OSG so
> if some explanations with code are welcome.<неиThanx in advance<неиBye<неи
> <неи<неи-----Original Message-----<неиFrom:
> [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of J.P.
> Delport<неиSent: Wednesday, April 30, 2008 10:49 AM<неиTo: OpenSceneGraph
> Users<неиSubject: Re: [osg-users] Ping-pong rendering<неи<неиHi,<неи<неиyou
> could have a look at the osgstereomatch example, see also the <неиreadme.
> I'm not sure what you mean by the "dynamic", but the example <неиuses
> ping-pong using a shader parameter.<неи<неиjp<неи<неиRoman Grigoriev
> wrote:<неи> Hi guys!<неи> <неи> Could you please advise me how to make
> dynamic ping pong rendering using <неи> osg2.4<неи> <неи> I tried but it
> doesn't work.<неи> <неи> tex1 and tex2 - textures for rendering.<неи> <неи>
> So I need in even frames:<неи> <неи>
> Camera->setRenderTargetImplementation(osg::Camera::FrameBufferObject);<неи>
> <неи> Camera->attach(osg::Camera::COLOR_BUFFER,tex1)<неи> <неи>
> Camerastateset->setTextureAttributeAndModes(0,tex2,osg::StateAttribute::ON);
> <неи> <неи> In odd frames:<неи> <неи>
> Camera->setRenderTargetImplementation(osg::Camera::FrameBufferObject);<неи>
> <неи> Camera->attach(osg::Camera::COLOR_BUFFER,tex2)<неи> <неи>
> Camerastateset->setTextureAttributeAndModes(0,tex1,osg::StateAttribute::ON);
> <неи> <неи> Thanx in advance<неи> <неи>  <неи> <неи>  <неи> <неи> <неи>
> ------------------------------------------------------------------------<неи
>> <неи> _______________________________________________<неи> osg-users
> mailing list<неи> osg-users@lists.openscenegraph.org<неи>
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org<не
> и<неи-- <неиThis message is subject to the CSIR's copyright terms and
> conditions, e-mail legal notice, and implemented Open Document Format (ODF)
> standard. <неиThe full disclaimer details can be found at
> http://www.csir.co.za/disclaimer.html.<неи<неиThis message has been scanned
> for viruses and dangerous content by MailScanner, <неиand is believed to be
> clean.  MailScanner thanks Transtec Computers for their
> support.<неи<неи_______________________________________________<неиosg-users
> mailing
> list<[EMAIL PROTECTED]<неиhttp://lists.openscenegraph.or
> g/listinfo.cgi/osg-users-openscenegraph.org<неи
> 
> 
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail 
legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at 
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their 
support.

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to