Hi,

I'm trying to get this shader to work:


Code:

#vertex
void main( void )
{
   gl_TexCoord[0] = gl_MultiTexCoord0;
   gl_Position = ftransform();
}

#fragment
#extension GL_ARB_texture_rectangle : enable

uniform sampler2DRect colorTexture;
const float alphaValue = 0.05; //The alpha value that indicates the part that 
will be visible. else gl_FragColor = vec4(0.0)

void main( void )
{
        vec4 color = texture2DRect(colorTexture, gl_TexCoord[0].st);

        if(color.a == alphaValue)
    {
                gl_FragColor = vec4(1.0,0.0,0.0,1.0);
    }
        else
                gl_FragColor = vec4(0.0);
}



This shader is just the first pass (RTT camera pass) of what I intend to do. I 
am trying to implement a certain kind of shader into the scene. I am trying to 
isolate the part that the shader will work on by getting the alpha channel. If 
alpha channel = 0.05 then it will be rendered to a texture, if not then it will 
just be black. I've got lots of .ive models with the textures of 1.0 alpha and 
0.05 alpha. However what I'm getting is just a blank black screen. I was 
thinking that maybe one of osgOcean's shader screwed up the alpha values or so. 
Can anybody help me with this please? Thanks a lot in advance.

Thank you!

Cheers,
Bawenang

------------------------
"There's no place like 127.0.0.1"

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





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

Reply via email to