Original Post
I''m haveing the strangest error, here it is:
Run-Time Check Failure #3 - The variable ''b'' is being used without being defined.
And here the offending code
void modelcalcnorm(float *p1, float *p2, float *p3)
{
float a[3];
float b[3];
float result[3];
float length;
a[0] = p1[0] - p2[0];
a[1] = p1[1] - p2[1];
a[2] = p1[2] - p2[2];
b[0] = p1[0] - p3[0];
b[0] = p1[0] - p3[1];
b[0] = p1[0] - p3[2];
result[0] = a[1] * b[2] - b[1] * a[2];
result[1] = b[0] * a[2] - a[0] * b[2];
result[2] = a[0] * b[1] - b[0] * a[1];
length = (float)sqrt(result[0]*result[0]+result[1]*result[1]+result[2]*result[2]);
glNormal3f(result[0]/length,result[1]/length,result[2]/length);
}
Now I dont understand how i can use a varible when its not defined, wouldnt that be a compile time error, and also, the varible is clearly defined. I''m at a lost.
"The most likely way for the world to be destroyed, most experts agree, is by accident. That''s where we come in; we''re computer professionals. We cause accidents."
-Nathaniel Borenstein