Hi, Peter.

There are extension NV_texture_barrier that allows read and write to same 
buffer with certain limitations. Though its not widely supported and you have 
to use opengl code in osg to use it.

And back to topic, seems like additive blending without clearing render target 
between frames will do the trick.

Cheers, Sergey.


21.02.2011, 18:10, "Peter Amstutz" <[email protected]>:
> My understanding is no, in general in GLSL you cannot read from the same
> buffer you are writing to.  The reasoning is that you can have multiple
> shader units potentially rendering the same pixel in parallel and/or
> rendering pixels that will never actually be drawn on screen due to
> z-buffering, so reading from the buffer would have undefined behavior
> (Z-buffer tests and blending are handled by dedicated hardware).  You
> want to render your first pass to a pbuffer and use that as an input
> texture to the second pass.
>
> However I believe a simpler solution in your case would be to enable
> blending and set your blending equation to GL_FUNC_ADD so that results
> of subsequent passes are additively combined with pixels from the
> previous pass.
>
> On 2/21/2011 9:52 AM, "Martin Großer" wrote:
>
>>  Hello,
>>
>>  Have everyone experience with the gl shading language? I would like to do 
>> something like that on my texture (I use render to texture):
>>
>>  gl_FragData[0] += vec(0.01,0,0,1);
>>
>>  Is that possible? I want to increment the color in my texture in every 
>> render pass (in this case the red channel). I don't want to copy back to the 
>> cpu memory. And I use the FRAME_BUFFER_OBJECT. I guess the gl_FragData[0] is 
>> in every render pass zero (black). Is it possible to change that?
>>
>>  Cheers
>>
>>  Martin
> --
> Peter Amstutz
> Senior Software Engineer
> Technology Solutions Experts
> Natick, MA
> 02131
>
> _______________________________________________
> 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

Reply via email to