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;
}



When I run my simple code using these shaders I do not see anything. I have 
messed around with multiple values and have determined that if I multiply 
'gl_FragColor = diffuseColor * reflectionColor' together then the model does 
not render at all.

Any of the following combinations are fine:


Code:
gl_FragColor = diffuseColor;
gl_FragColor = reflectionColor;
gl_FragColor = diffuseColor * diffuseColor;
gl_FragColor = reflectionColor * reflectionColor;
gl_FragColor = vec4(1.0,1.0,1.0,1.0) * reflectionColor;
gl_FragColor = diffuseColor * vec4(1.0,1.0,1.0,1.0);



Am I completely missing something? I'm only multiplying to vectors together, 
but if one vector comes from a textureCube and the other comes from a texture2D 
then they seem to not like each other.

Attached is my entire code to run these shaders.

Joe

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




Attachments: 
http://forum.openscenegraph.org//files/main_354.zip


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to