Quote:Original post by zedzeek
in the shader if u use gl_Normal then this reads whatever the current normal is
ie glNormal3fv( normal );
it doesnt take a uniform as input like youre doing
I was only using the uniform as a test. I would set a uniform to the normal vector *instead of* calling glNormal3f and using gl_Normal in the shader.
However, it is looking like it is the varying variable that are causing the problem. I thought I understood them but I guess I don't. For instance...
If I do..
varying vec3 n;void main (void){ n = vec3(0, 0, 0); gl_Position = ftransform();}
and
varying vec3 n;void main (void){ if(n.x == 0.0 && n.y == 0.0 && n.z == 0.0) gl_FragColor = vec4(1,0,0,1); else gl_FragColor = vec4(0,1,0,1);}
I see the model color as GREEN. If I change the code to...
varying float nx;varying float ny;varying float nz;void main (void){ nx = 0.0; ny = 0.0; nz = 0.0; gl_Position = ftransform();}
and
varying float nx;varying float ny;varying float nz;void main (void){ if(nx == 0.0 && ny == 0.0 && nz == 0.0) gl_FragColor = vec4(1,0,0,1); else gl_FragColor = vec4(0,1,0,1);}
It works as I expect and the result is a RED model.
Can some one plllleeeeaaassseee explain this to me? :-)
Thanks for all your help so far,
--Andrew