Registered Member
|
I'm currently coding a simple openGL renderer. I've been very confused to what I should be using for my models worldtransform matrix, not sure if I should have an Affine3f or a Matrix4f? ( Is the Affine3f matrix actually an 4x4 matrix with the end column and bollom row set to 0,0,0,1?).
I want to be able to use Eigens built in transform functions like translate/rotate/scale to move my models. |
Moderator
|
Affine3f is what you need here, and yes internally it's a 4x4 column major matrix. You can access it trough .matrix() for low level manipulations. Not also the unsupported/OpenGLSupport module which provides many convenient methods to interface Eigen with OpenGL.
|
Registered Member
|
I thought affine would be the one to use, but I had problems with it.
When I changed everything to use the affine3f. Such as the projection matrix, model transforms and the view matrix it worked. Just wondering why the following cases work and not work. The MVP is the model-view-projection matrix and is passed into the shader of my models. This works and renders all my models at their orgin.
This breaks.
Why would this break?
It confuses me why multiplying by the identity matrix is breaking it. |
Moderator
|
There is a problem here. A projection transformation is not affine, so you should use a Projective3f for VP and MVP, and reserve Affine3f for mCurrViewMatrix and mWorldCoordMatrix.
|
Registered Member
|
Thanks ggael! Didn't know there was a Projective3f. Was it breaking because the affine3f assumed the last row and last column at 0001?
|
Moderator
|
yes Affine* assumes the last row is 0....01
|
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft