ok, ive had this problem for a few days now, and ive narrowed it down. But, i still cant figure out how to fix it, or what to even look for to fix it.
This is what ive come up with.

the problem(if you didnt read my last post) is that i get an error toward one particular function. Only when i link, not when i compile. the linking error is telling me that the function prototype exists in a .h file, but the compiler cant find the function anywhere. Thats ok, probably due to a DLL or .lib, right? Not a DLL, or i would have an error when starting the program, not linking. so im definitely missing a .lib.
The function prototype is:


void gltGetNormalVector(const GLTVector3 vP1, const GLTVector3 vP2, const GLTVector3 vP3, GLTVector3 vNormal);

its first three parameters are arrays of three float values(per parameter), which are vertices for a plane(obviously). This function returns an array of 3 floats that you will use in a call to glNormal. Basically, glNormal is used for the angle at which light reflects off the surface(i believeā€¦ im still new to this). What ive found out about my problem is that i dont think i have the correct .lib file for the job, but that would mean i would need an updated one, because i have every one that i know opengl uses, and then some. ive never needed to include 7 libs in any program ive ever done before. But, my question is since i dont think i need any other libs, which lib should be updated? and for that matter, does it even need to be updated? or is this function even in existance? because i googled this function, and out of 8 trillion pages, this function didnt appear once. Peculiar.

thanks for any help.


Well there is an OpenGL wrapper library called libglt, so you could try glt.lib or libglt.lib as a shot in the dark.

Unfortunately, your function does not seem to be part of the library.

Anyhow, assuming that a GLTVector3 is simply an array of 3 real numbers, then the function would be like this:

/* note: p1,p2,p3 are assumed CCW-ordered
void gltGetNormalVector(
const GLTVector3 vP1,
const GLTVector3 vP2,
const GLTVector3 vP3,
GLTVector3 vNormal)
GLTVector3 v1, v2;
double l;

/* two divering vectors in plane
v1[X] = vP2[0]- vP1[0];
v1[Y] = vP2[1]- vP1[1];
v1[Z] = vP2[2]- vP1[2];

v2[X] = vP3[0]- vP1[0];
v2[Y] = vP3[1]- vP1[1];
v2[Z] = vP3[2]- vP1[2];

/* cross product to get normal
vNormal[0] = v1[1] * v2[2] - v1[2] * v2[1];
vNormal[1] = v1[2] * v2[0] - v1[0] * v2[2];
vNormal[2] = v1[0] * v2[1] - v1[1] * v2[0];

/* length of normal
l = sqrt(vNormal[0], vNormal[1], vNormal[2]);

/* normalize to unit length
vNormal[0] /= l;
vNormal[1] /= l;
vNormal[2] /= l;



/* length of normal
l = sqrt(vNormal[0]*vNormal[0] +
vNormal[1]*vNormal[1] +

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.