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

Eigen::Matrix4d to QMatrix4x4 and viceversa

Tags: None
(comma "," separated)
linello
Registered Member
Posts
56
Karma
0
OS
Are there adapter methods in Eigen to simply convert between Eigen::Matrix4d and QMatrix4x4 or for example between Eigen::Vector3d and QVector3D?

I would like to feed my uniform in my vertex shader program handled by QGLSLProgram with setUniformValue with proper QMatrix and QVector3D.

And as other question, is the storage-order automatically handled between column-major Eigen method and row-major OpenGL method when feeding uniform mat4 to a GLSL shader or should I transpose the matrices?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
You can use our OpenGLSupport module to specify uniform from Eigen's objects without boring about storage order and temporary evaluation, e.g.:
Code: Select all
Matrix4f A;
Matrix<float,4,4,RowMajor> B;
glUniform(loc, A);
glUniform(loc, B);
glUniform(loc, A+B);


Bookmarks



Who is online

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