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
    Senior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    183

    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
    2,978

    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
    Senior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    183

    Re: Calculating light coordinates

    Hi there!

    You should generate the inverse of this
    matix, and voila

    CU

    LG

Similar Threads

  1. Calculating texture coordinates
    By Lee_Jennifer_82 in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 11-30-2015, 01:23 PM
  2. Calculating texture Coordinates
    By WillsB in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 03-18-2009, 05:57 PM
  3. Calculating UV Mapping coordinates
    By NordFenris in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 03-12-2002, 12:42 PM
  4. Calculating UV coordinates for a Bezier Patch
    By Quaternion in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 06-09-2001, 09:26 AM
  5. Replies: 1
    Last Post: 01-21-2001, 11:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean