0

I am trying to create an orthographic view (separate from the final perspective view). I know the view's scale, position, it's up vector, and the point it's looking at. So it seems easiest to simply use glm::lookAt() to create the view matrix, except there's no way to specify scale.

Is there a way to introduce scaling with glm::lookAt()? I don't think it's possible to scale the matrix made by lookAt, since scaling needs to happen first to get the 'expected' result (objects appearing larger or smaller, like zooming a camera in or out). I may be wrong there though.

If it's not possible while using lookAt, is there a series of glm functions that would be equivalent?

1
  • did you try the normal scaling matrix? Feb 11, 2015 at 16:10

1 Answer 1

0

In terms of matrix transformations, you can start with a scale and apply the glm::lookAt() matrix afterwards. I'm not familiar with glm, but I have used GLUT before. You should be able to do a matrix multiplication like this (I'm assuming that you've already transformed everything into scene space, defined all the variables etc.)


    TransformedVector = glm::lookAt(cameraPosition,
                                    cameraTarget,  
                                    upVector) * 
                        glm::scale(scalingFactor, 
                                  scalingFactor, 
                                  scalingFactor) * 
                        OriginalVector;

If this behaves peculiarly try swapping the glm::lookAt() and glm::scale() order.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.