Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Calculating light coordinates

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    3

    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

  2. #2
    Junior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    200

    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

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    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

  4. #4
    Junior Member Newbie
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    3

    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

  5. #5
    Junior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    200

    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
  •