Hi Bawenang, I'm not 100% sure what you're trying to do, but I would say that the error is due to the floating point comparison, try testing for a small range rather than an explicit value.
On a side note osgOcean uses a custom cull traversal ( http://code.google.com/p/osgocean/source/browse/trunk/src/osgOcean/OceanScene.cpp#767) so I'm not sure how that would react to having prerender cameras added as children of ocean scene - It might work, but I haven't tested it. Regards, Kim. On 3 August 2011 08:50, Bawenang Rukmoko <ben...@cs.its.ac.id> wrote: > 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 >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org