-
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?
CU
Peter
-
Junior Member
Regular Contributor
Re: Calculating light coordinates
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
-
Senior Member
OpenGL Guru
Re: Calculating light coordinates
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 
Bob
-
Re: Calculating light coordinates
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
-
Junior Member
Regular Contributor
Re: Calculating light coordinates
Hi there!
You should generate the inverse of this
matix, and voila 
CU
LG
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules