This post isn’t a question. It’s a solution I’m posting here in case someone else makes the same mistake I made.
After rewriting one of my 3D vector classes I noticed a bug in my renderer. It appeared that my fixed lights were following the camera and the associated specular highlight on models was incorrect as the camera moved around the scene.
I quickly arrived at OpenGL.org and searched for similar problems being posted. I found a lot of folks with similar symptoms. I also found many informative answers from Dorbie and others reminding to set the light position at the proper time in the model view matrix creation.
After verifying that I was creating the projection and the model view matrices correctly and verifying the light position was being set at the proper time, I still had the same problem.
After re-reading the lighting section in the red book again the solution occurred to me…
My new 3D vector library was specifically x, y, and z. No homogenous coordinate at the end of my 3 coordinate vector.
The red book specifically states when setting a light position using a vector the vector must contain a fourth value of zero.
When I passed the 3 value vector array to OpenGL, I now know I may have been causing a memory read overrun, so the fourth value would be undefined.
The result looked as if the light position statement was being set at the wrong time in relation to the view transform, even though it was correct.
Simply adding a fourth value of zero to the vector being passed when setting the light position fixed the problem.