Hey,
I'm adding normal mapping to a Quake 3 BSP map via a GLSL shader, and so far, everything has worked great. However, I've come to a problem with regards to my light in the scene (there is currently only one) moving with my camera. I'm guessing this is a matrix error somewhere, but so far I haven't been able to correct it. When the camera shifts left, the light moves with it, and when rotated, does the same. Weird. Here is my rendering code:
void RenderScene()
{
glLightfv (GL_LIGHT0,GL_POSITION,g_lightpos);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
Camera.Look(); //Note: Camera.Look() just calls gluLookAt...could this
//be the problem?
BSP.Render(Camera.Position());
SwapBuffers(g_hDC);
}
And here is my vertex shader:
varying vec4 pos;
void main( void )
{
gl_Position = ftransform();
pos = gl_ModelViewMatrix * gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}
The BSP level is rendered fine.
Any ideas?