What does ofMultMatrix() do?

What does ofMultMatrix() do?

Does it transform the position and orientation of objects? (like calling ofTranslate() and ofRotate())?

1 Like

Yes, it does. For example, instead of using ofRotate you could create a rotation matrix using glm::rotate and then pass that matrix to ofMultMatrix.

A nice example of ofMultMatrix in use is for doing quad warping of an image or FBO. For example, here:

The warper is configured to do a quad-warp based on 4 input and output points and the addon then uses openCv’s homography functions to create an affine transform matrix. That complex matrix is then multiplied to with the current matrix in one shot. Conveniently, you can use the normal ofPushMatrix() ofMultMatrix() ofPopMatrix() to “undo” a multmatrix operation, just like you can with ofRotate(), ofTranslate(), etc.