PDA

View Full Version : Camera view matrix



SasMaster
04-17-2012, 11:11 PM
Ok ,please bear with me as it is probably really NOOB's question.
I am coding a 3d camera.Trying to set its matrix.Using glm lib.
Now ,I have moveRight(GLFloat value); method which is supposed to move camera to the right .Inside it I redefine camera view matrix
like this:



m_viewMatr=glm::lookAt(glm::vec3(value,0,0),glm::v ec3(value,0,-1),glm::vec3(0,1,0));





The problem is that it seems that camera direction doesn't seem right.It looks like the camera moved lets say 100 pixels to the right but look direction hasn't changed accordingly. What do I miss here? Should I keep camera rotation matrix separately and then multiply "target" (look direction) vector with that rotation matrix? I thought that glm::lookAt() should solve it automatically .

Thanks.

UPDATE: Well , in fact it does work.The problem was around frustum wrong scale which removed some of the geometry out of view bounds.