Hi I have a problem with a two pass shader,
moving from release 1.9.8 of OSG to 2.2 and later.
The shader used to work properly, and now all I get
are black pixels!
I can see that the scene is actually there because I can pick
the objects, even if they are totally black.
The program is a two pass shader, that renders everything
on a texture and then sets up a quad where the texture is mapped
and a camera that looks at the quad.
Here are the simple versions of the shaders:
First pass vertex:
varying vec2 FragmentPosition;
void main(void)
{
gl_Position = ftransform();
FragmentPosition = gl_MultiTexCoord0.st;
}
First pass fragment:
varying vec2 FragmentPosition;
uniform float DistanceMultiplier;
uniform float SelectedZone;
uniform vec4 HighlightColor;
uniform float HighlightWeight;
vec4 ReadFromRT(vec2 position);
float GetDistanceMultiplier();
void main(void)
{
vec4 originalColor = ReadFromRT(FragmentPosition);
gl_FragColor = SelectedZone == 1.0 ? mix(originalColor,
HighlightColor, originalColor[3] * HighlightWeight) : originalColor;
}
Second pass:
uniform sampler2D InputTexture;
vec4 ReadFromRT(vec2 position)
{
return texture2D(InputTexture, position);
}
varying vec2 FragmentPosition;
void main(void)
{
gl_Position = ftransform();
FragmentPosition = gl_MultiTexCoord0.st;
}
vec4 ReadFromRT(vec2 position);
varying vec2 FragmentPosition;
void main(void)
{
gl_FragColor = ReadFromRT(FragmentPosition);
}
I haven't changed the shaders since then. Any idea?
Thanks
--
Tiziano Diamanti Ph.D.
HPC and Visualization
Cineca
Italy
Tel. +39-051-6171717
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org