PDA

View Full Version : weird transformation problem



McBain
11-23-2001, 05:37 PM
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 ???????????????

Morglum
11-26-2001, 12:52 AM
Try transposing M-1

12-03-2001, 09:51 AM
With my camera routines,
I always translate and rotate with
the negative camera values.