This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to map correctly GL_MODELVIEW_MATRIX to Affine3d

Tags: None
(comma "," separated)
linello
Registered Member
Posts
56
Karma
0
OS
Hi you all,


I'm wondering how to map the content of GL_MODELVIEW_MATRIX
correctly to an Eigen::Affine3d transformation.

I know that both have column-order storage order, but I don't know how to pick the current GL_MODELVIEW_MATRIX and write a deep copy to Affine3d.

Code: Select all
Affine3d M;
glGetDoublev(GL_MODELVIEW_MATRIX,M.data());


should do the trick but data() is a const member function, so it's not possibile to write onto, and obviously this is not a deep copy.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
oh, there is no non const version of .data() in Transform<>, you can workaround using:

M.matrix().data()
linello
Registered Member
Posts
56
Karma
0
OS
I'm I ensured that by using transform.matrix.data() the storage order is the same?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
yes, it is column major like OpenGL.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]