From dfc97ba1f291f7793d95f8ea66a5c1724269d5ef Mon Sep 17 00:00:00 2001 From: cnr-isti-vclab Date: Thu, 30 Oct 2008 10:47:08 +0000 Subject: [PATCH] fix Matrix44 infinite product, make glGetv not allocate temporary --- vcg/math/matrix44.h | 4 ++-- wrap/gl/math.h | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/vcg/math/matrix44.h b/vcg/math/matrix44.h index 5f0be2f0..385040f5 100644 --- a/vcg/math/matrix44.h +++ b/vcg/math/matrix44.h @@ -464,9 +464,9 @@ template struct ei_matrix44_product_impl { typedef typename Other::Scalar Scalar; - typedef typename Eigen::ProductReturnType,Other>::Type ResultType; + typedef typename Eigen::ProductReturnType::Base,Other>::Type ResultType; static ResultType run(const Matrix44& tr, const Other& other) - { return tr * other; } + { return (static_cast::Base&>(tr)) * other; } }; template diff --git a/wrap/gl/math.h b/wrap/gl/math.h index a1503684..4e382f99 100644 --- a/wrap/gl/math.h +++ b/wrap/gl/math.h @@ -133,14 +133,12 @@ inline void glGetv(const GLenum pname, Eigen::Matrix& matrix){ glGetDoublev(pname,matrix.data()); } inline void glGetv(const GLenum pname, Eigen::Matrix& matrix){ - Eigen::Matrix4f tmp; - glGetFloatv(pname,tmp.data()); - matrix = tmp; + glGetFloatv(pname,matrix.data()); + matrix.transposeInPlace(); } inline void glGetv(const GLenum pname, Eigen::Matrix& matrix){ - Eigen::Matrix4d tmp; - glGetDoublev(pname,tmp.data()); - matrix = tmp; + glGetDoublev(pname,matrix.data()); + matrix.transposeInPlace(); } template inline void glGetv(const GLenum pname, const Eigen::Transform& t)