is there any explication why i get different results while a fragment shader is running in software or in hardware … for testing im doing a lot of stuff i my fragment shader, but it shouldnt affect the fragment color. normaly i would expect that there is no difference …
uniform vec4 lightPos;
uniform vec4 eyePos;
varying vec3 N;
varying vec3 V;
void main(void)
{
gl_TexCoord[0] = gl_MultiTexCoord0;
vec3 P = vec3(gl_ModelViewMatrix * gl_Vertex);
N = gl_NormalMatrix * gl_Normal;
V = vec3 (gl_ModelViewMatrix * eyePos) - P;
gl_Position = ftransform();
}
void main (void)
{
// must be inserted. driver bug!!!
gl_TexCoord[0];
//vec4 base = texture2D(baseEnvironmentImage, vec2(gl_TexCoord[0]));
vec3 nN = normalize(N);
vec3 nV = normalize(V);
float rim = pow(1.0 - max(dot(nV, nN), 0.0), rimPower);
// cubemap reflection
vec3 R = reflect(-nV, nN);
// main axis direction
int mAI = 0; float t = abs (R.y); float ma = abs (R.x);
if (t > ma) { mAI = 1; ma = t; }
t = abs (R.z);
if (t > ma) { mAI = 2; }
float tc; float sc;
if (mAI == 0)
{
tc = -R.y;
if (R.x > 0.0) { sc = -R.z; } else { sc = R.z; }
}
else
{
if (mAI == 1)
{
sc = R.x;
if (R.y > 0.0) { tc = R.z; } else { tc = -R.z; }
}
else
{
tc = -R.y;
if (R.z > 0.0) { tc = R.x; } else { tc = -R.x; }
}
}
gl_FragColor = vec4(0.0, 1.0, 0.0 , 1.0);
gl_FragColor = vec4(1.0, 0.0, 0.0 , 1.0);
gl_FragColor = vec4(0.0, 0.0, 1.0 , 1.0);
gl_FragColor = vec4(R, 1.0);
}
… normaly this should be the same or ??
void main (void)
{
// must be inserted. driver bug!!!
gl_TexCoord[0];
vec3 nN = normalize(N);
vec3 nV = normalize(V);
// cubemap reflection
vec3 R = reflect(-nV, nN);
gl_FragColor = vec4(R, 1.0);
}
i dont want to conceal that this i only get different results, if i switch on my shadow map shader … which is using gl_TexMatrix[0] for light matrix transferation … but anyway … if im doing somethin wrong … in both cases i should get the same result or not ??? could it depend of the gl_TexCoord[0]; … which i have to add and seems to be a bug ??? its eye-catching, that this error only appear, while using texture unit zero …