weird transformation problem

i have to do this:

  • loadidentity
  • lightpos = x
  • camera transformations
  • lightpos = (10, 10, 10)

now i have to know x
did it like this:

  • loadidentity
  • camera transformations
  • get M and calculate M-1
  • light_coord = (10, 10, 10) * M-1
  • loadidentity
  • draw point at light_coord

this should be the same as:

  • loadidentity
  • camera transformations
  • draw point at light_coord

but this is not the case
if my camera transformation is just a gluLookAt:
works if i draw point at (light_coord.x, light_coord.y, -light_coord.z), notice the -

if my camera transformations also have a rotation the whole thing is flipping

i calcualte M * M-1 in my display routine and it gives Identity every time, so M-1 is calculated correctly.

what the **** am i missing here ???

Try transposing M-1

With my camera routines,
I always translate and rotate with
the negative camera values.