Lighting with glTranslate?

My program has a Map, and a set of models that were loaded from 3ds files. It creates a call list for each model, and depending on where I want to draw a model it uses

gltranslate
glcalllist(which model)

Now is there some way to light each model correctly with using gltranslate? Or what I am doing now which is

gltranslate
update light position with respect to where I translated the model to
glcalllist( draws the model )
set the light position back to origional position.

You can use glTranslate for translating light positions. But what do you explicitly want to do ? I don’t understand why you translate back the light position.

right now I am using this to set the position of my light.

glLightfv(GL_LIGHT0, GL_POSITION, lightPos);

If I keep the light in one place it draws the light on the map just fine. But I am using gltranslate to place each model calllist. The lighting doesn’t change, no matter where I would place the model. This is because it’s lighting each model on the position it’s created in the call list and not where it’s translated to.

Now I was able to get this to work. I did it by lets say the model moved over 10, then I would take the lightPos for that model and move it the other way 10. Then move it back, I do this for each model.

How do I setup a light to work with gltranslate?

I don’t really understand what you really want to do but I’ll still try to answer to your question.

For moving a light without touching to its position, just use glTranslate before a call to glLightfv (GL_LIGHT0, GL_POSITION, light_pos). It’s like translating the objects.

Hope that helps.