I Have used a copy of unchanged pixels and it works,
 but I have still a question:
I try to remove the pinponging by giving the 2 passes same textures as input
and output... ( new renderPass(texture[0],texture[0]))
And it works perfectly?!!! Performances are the same and i can use discard
Can someone can give me clues about why is it working as everywhere on the
net advise not to use a read/write texture in shader???


Hi,

try copying the input texture value to the output instead of using discard.
jp

Julien Valentin wrote:
> Hello all,
> I'm playing with the osg gameoflife example in order to implement a
> FastIterativeMethod using the pingpong textures and a FBO already in the
> example.
> This iterative method is looping over several GPU loops (a pixel
> shader)  until it converges ( all pixels are set).
> Pixel shader seems like it:
> main(){
> if (need to update current pixel)
>      gl_FragColor=updatedcolor;
> else    gl_FragColor=oldcolor;;
>
> }
> It work fine but there's no convergence test in order to stop looping in
> the shader....
> For the purpose of convergence test I would like to use an occulsion
> query that return the number of pixel setted in a loop (not discarded).
> For this I modify my shader:
> main(){
> if (need to update current pixel)
>      gl_FragColor=updatedcolor;
> else discard;
>
> }
> So It discard fragment that dont need to be setted again with the same
value
> Now each pixel would  update  when it need otherwise it is would discard
> itself.
>
> But with this code the result on my textured quad s don't stop flicking
> between correct color and a checkboard ..:(
>
> Do you know where the problem  is?
> It seems to be like osg is not calling the two pingpong passes
> alternately...
>
> NB:To sum up, The only change I made from the osg gameOfLife  example is
> the shader where i introduces a discard branch...
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to