From b9b272547894ca599727a1233139c8d7d80c6957 Mon Sep 17 00:00:00 2001 From: cignoni Date: Mon, 9 Oct 2006 19:56:09 +0000 Subject: [PATCH] Removed the default use of the OpenGL transpose extension. Added two method for direct (non transposed) matrix multiplication and getting --- wrap/gl/math.h | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/wrap/gl/math.h b/wrap/gl/math.h index e6a84a39..c9f343f5 100644 --- a/wrap/gl/math.h +++ b/wrap/gl/math.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.10 2006/02/13 13:05:05 cignoni +Removed glew inclusion + Revision 1.9 2004/09/30 00:48:07 ponchio -> @@ -67,7 +70,7 @@ Revision 1.1 2004/03/31 15:27:17 ponchio namespace vcg { -inline void glMultMatrix(const Matrix44f &matrix) { +inline void glMultMatrixE(const Matrix44f &matrix) { //glMultMatrixf((const GLfloat *)(matrix[0])); if(glMultTransposeMatrixf) glMultTransposeMatrixf((const GLfloat *)(matrix[0])); else { @@ -77,8 +80,13 @@ inline void glMultMatrix(const Matrix44f &matrix) { } } -inline void glMultMatrix(const Matrix44d &matrix) { -// glMultMatrixd((const GLdouble *)(matrix[0])); +inline void glMultMatrix(const Matrix44f &matrix) { + Matrix44f tmp(matrix); + Transpose(tmp); + glMultMatrixf((const GLfloat *)(tmp[0])); +} + +inline void glMultMatrixE(const Matrix44d &matrix) { if(glMultTransposeMatrixd) glMultTransposeMatrixd((const GLdouble *)(matrix[0])); else { Matrix44d tmp(matrix); @@ -86,6 +94,19 @@ inline void glMultMatrix(const Matrix44d &matrix) { glMultMatrixd((const GLdouble *)(tmp[0])); } } +inline void glMultMatrix(const Matrix44d &matrix) { + Matrix44d tmp(matrix); + Transpose(tmp); + glMultMatrixd((const GLdouble *)(tmp[0])); +} + +inline void glMultMatrixDirect(const Matrix44f &matrix) { + glMultMatrixf((const GLfloat *)(matrix[0])); +} + +inline void glMultMatrixDirect(const Matrix44d &matrix) { + glMultMatrixd((const GLdouble *)(matrix[0])); +} inline void glMultMatrix(const Similarityf &s) { glTranslatef(s.tra[0], s.tra[1], s.tra[2]); @@ -108,10 +129,20 @@ inline void glMultMatrix(const Similarityd &s) { inline void glGetv(const GLenum pname, Matrix44f & m){ glGetFloatv(pname,&m[0][0]); + Transpose(m); } inline void glGetv(const GLenum pname, Matrix44d & m){ glGetDoublev(pname,&m[0][0]); + Transpose(m); +} + +inline void glGetDirectv(const GLenum pname, Matrix44f & m){ + glGetFloatv(pname,&m[0][0]); +} + +inline void glGetDirecv(const GLenum pname, Matrix44d & m){ + glGetDoublev(pname,&m[0][0]); }