Setting the light position right after glloadidentity() should give you lights that just stay where they are supposed to be, right?
My render routine first does some rotation and translation for the camera, then does rotation and translation for each mesh, then renders the mesh.
No matter what I do, my lights move with the position AND orientation of the camera! What am I doing wrong?
Thanks.
glViewport 0,0,w,h
glClear GL_COLOR_BUFFER_BIT Or GL_DEPTH_BUFFER_BIT
glLoadIdentity
gluPerspective 45.0,w/h,nearrange,farrangesetuplight
glPushMatrix
glRotatef -EntityRoll(camera),0,0,1
glRotatef EntityPitch(camera),1,0,0
glRotatef -EntityYaw(camera),0,1,0
glTranslatef -EntityX(camera),-EntityY(camera),EntityZ(camera)glScalef 1,1,-1
render a bunch of stuff here
glPopMatrix
End FunctionFunction setuplight()
glEnable GL_LIGHT0
bank=CreateBank(16)
PokeFloat bank,0,1.0
PokeFloat bank,4,1.0
PokeFloat bank,8,1.0
PokeFloat bank,12,0.0
glLightfv GL_LIGHT0,GL_DIFFUSE,bank
FreeBank bank
bank=CreateBank(16)
PokeFloat bank,0,0
PokeFloat bank,4,0
PokeFloat bank,8,0
PokeFloat bank,12,1.0
glLightfv GL_LIGHT0,GL_POSITION,bank
FreeBank bank
glLightf GL_LIGHT0, GL_CONSTANT_ATTENUATION, 2.0)
glLightf GL_LIGHT0, GL_LINEAR_ATTENUATION, 1.0
glLightf GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.1
End Function