On 07/29/2011 11:42 AM, Joe Abreu wrote:
Hi,

I have a problem that I have got my mind stuck at working out what is going 
wrong. I have a simple vertex and fragment shader I am trying to test. which 
look as follows:

vertex:

Code:
varying vec3 normal, eyeVec, reflectVec;
void main()
{
   gl_TexCoord[0] = gl_MultiTexCoord0;
   gl_Position = ftransform();
   normal = normalize(gl_NormalMatrix * gl_Normal);
   eyeVec = vec3(gl_ModelViewMatrix * gl_Vertex);
   reflectVec = reflect(eyeVec, normal);
};


fragment:

Code:
varying vec3 normal, eyeVec, reflectVec;
uniform sampler2D diffuseMap;
uniform samplerCube reflectionCube;
void main()
{
   vec4 diffuseColor = texture2D(diffuseMap, gl_TexCoord[0].st);
   vec4 reflectionColor = textureCube(reflectionCube, reflectVec);
   gl_FragColor = diffuseColor * reflectionColor; //<-- This is my offending 
line
   gl_FragColor.a = 1.0;
}

Hi,  Joe,

Just a shot in the dark (all I've got time for, sorry). What happens if you try this:

   gl_FragColor.rgb = diffuseColor.rgb * reflectionColor.rgb;
   gl_FragColor.a = 1.0;


--"J"

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

Reply via email to