PDA

View Full Version : Calculating light coordinates



pherweg
03-28-2000, 09:55 AM
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?

CU
Peter

lgrosshennig
03-29-2000, 01:40 PM
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!

LG

Bob
03-30-2000, 02:22 AM
Hello

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 http://www.opengl.org/discussion_boards/ubb/tongue.gif

Bob

pherweg
03-31-2000, 06:40 AM
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?

CU
Peter

lgrosshennig
03-31-2000, 09:47 AM
Hi there!

You should generate the inverse of this
matix, and voila http://www.opengl.org/discussion_boards/ubb/smile.gif

CU

LG