camera / model matrix errors
I'm just confused about all this... I have these matrix transforms almost right but they're not quite right.
The camera has position, "forward," "up," and "right" vectors.
So does the object.
To render the object I do
gl.glLoadMatrixd(cameramatrix,0);
gl.glMultMatrixd(object1.getObjectMatrix(),0);
and then draw the points.
The camera matrix is:
-side.x,up.x,-forward.x,0
-side.y,up.y,-forward.y,0
-side.z,up.z,-forward.z,0
position(dot)side,position(dot)up,position(dot)forward,1
The object matrix is:
side.x,side.y,side.z,0
up.x,up.y,up.z,0
forward.x,forward.y,forward.z,0
position.x,position.y,position.z,0
I think I have it mostly correct but things are weird... I think pitching up pitches the camera down among other things. Can anyone help me find the errors, or point me to a resource to help me learn about this (I'm having trouble finding information on this specific method of orientations)?
Couple quick comments. Although you may be indexing them correctly in the code, you're writing your matrices in row-vector format, and OpenGL uses column vectors. Also, I think the middle translation element of your camera matrix needs to be negated. Can't comment on the rotation direction, since we don't know how exactly you're computing your side, up and forward vectors.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement