Hi there,
If i understand you want to do render to texture (RTT) pass:
You have several choice in order to do that. I give you the more classic
RTT  with multitexturing:

//need 3 textures texA &texB input values and TexC binded to camera via fbo
uniform sampler2D texA;
uniform sampler2D texB;

void main(){
vec4 color1=sample(texA,texcoord.x,texxcoordy);
vec4 color2=sample(texA,texcoord.x,texxcoordy);

//you blending function
gl_fragcolor=color1*(color1.a)+color2*color2.a*(1-color1.a);
}

The only thing you have to do is to declare a camera on prerender step whose
frame buffer is attached to the texC and bind shader parameters to texA and
texC
Hope it will fit your usage ( see osggameoflife for RTT)


> Hi JP
>
> For now I Initialize a texture with the value A, in the shader I put the
> value B and I would like to have a the end in the texture the max blending
> between the value A and B.
>
> Lets do an example:
>
> I create an texture Tex initialized with color red (1,0,0,1)
>
> I attach my texture to a camera Camera->attach(osg::Camera::COLOR_BUFFER0,
> Tex);
>
> I use a shader witch do this treatment: gl_FragData[0] =
> vec4(0.0,1.0,0.0,1.0);
>
> And I would like have a yellow (1.0,1.0,0.0,1.0) texture at the end of the
> treatment.
>
> For now using an osg::BlendEquation with RGBA_MAX blending, I have if I
> define a clearColor to my camera the blending between this clearColor and
> the color use in the shader. I think this is normal because the
> blendEquation define how the blending is doing between the color previously
> in the frame buffer and the added color. But it's not what i want I would
> like to have the blending between the color previously in the texture and
> the added color.
>
> Thanks for your help
>
> Clement
>
> 2010/1/7 J.P. Delport <[email protected]>
>
> > Hi Clement,
> >
> > could you explain a bit more what you expect and what you are getting? Do
> > you want to blend between the different textures (AFAIK you cannot do
> this
> > unless you do another pass)? Are you expecting max, but getting average?
> >
> > jp
> >
> > clement vidal wrote:
> >
> >>
> >> Hi,
> >>
> >> I have a problem with BlendEquations and shaders. That is the situation:
> >>
> >> I attach several textures to my camera using COLOR_BUFFER0,
> >> COLOR_BUFFER1, ...
> >> I use a shader to make the rendering into this textures.
> >>
> >> There is some values in this textures and i would like to use a max
> >> blending between the value wich are already in and the values i affect
> in
> >> the shader.
> >>
> >> When I define an osg::BlendEquation with RGBA_MAX blending, i have the
> >> blend result between the value in the frame buffer (background color or
> >> ClearColor ) and the value in the shader.
> >>
> >> What I do wrong? Somebody have a idea?
> >>
> >> Thanks for helping
> >>
> >>
> >> ------------------------------------------------------------------------
> >>
> >>
> >> _______________________________________________
> >> osg-users mailing list
> >> [email protected]
> >>
> 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.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