Sign in to follow this  
hooded_paladin

camera / model matrix errors

Recommended Posts

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)?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this