Calculating light coordinates

Hello world,

at start of my RenderScene() function i put a light on a particular position (say x100,y100,z100). After translating and rotating and drawing other objects i’d like to know where my light is. But cause of rotating and translating the point (x100,y100,z100) isn’t where is was.

Is there a better way then to save all rotations and translations in a matrix and to calculate backwards?


Hm, sorry I did’nt realy get it!

Looks like your are mixing up World coordinates with display coordinates!

Please send me an email, I’m an german
native speaker…

May the vector be with you!



A slightly better way of doing this instead of saving all transformations, is to actually get the modelview matrix.

GLdouble mvmatrix[16];
glGetDoublev(GL_MODELVIEW_MATRIX, mvmatrix);

… and you have your modelview matrix, then you can calculate it backwards. No need to save all transformatrions


Hi Bob,

thanks for replying to my message.

OK. I got the modelview matrix.
But now? How to calculate backwards?

I don’t need a ten page listing. But i’d appreciate a little hint. (Would be great)
What function to use?


Hi there!

You should generate the inverse of this
matix, and voila