View Full Version : gluLookAt question

05-23-2006, 02:27 PM
Hi everyone,

In my application I'm provided with three axes in world coordinates. They are called vup, vpn and vright, and correspond to the y, z and x axes I'd like to use when applying transformations to my verticies. I also have a point which will serve as the origin for this new coordinate system. It's called "origin".

I'm going crazy trying to use these things when establishing up my modelview transform. I want to apply all transformations based on this new origin and x, y and z axes, but I can't get it working right. I've tried gluLookAt() in this fashion:

gluLookAt(origin.x, origin.y, origin.z, vpn.x, vpn.y, vpn.z, vup.x, vup.y, vup.z)

....and it doesn't work right. After setting the modelview this way and drawing primitives things look kooky. I've done things like subtracted the origin from my vpn and used that in the second portion of gluLookAt() and it was no better.

Does anyone see something obviously wrong with what I'm doing? I know for a fact the three axes I'm using are mutually perpendicular; I can draw them with GL_LINEs using the default identity modelview matrix, at my origin point, and they look great.

Is there a way I can directly set the modelview matrix to use those axes and origin, instead of going through gluLookAt()? Thanks very much.

05-23-2006, 09:24 PM
gluLookAt(origin.x, origin.y, origin.z, origin.x+vpn.x, origin.y+vpn.y, origin.z+vpn.z, vup.x, vup.y, vup.z)