Removed the default use of the OpenGL transpose extension. Added two method for direct (non transposed) matrix multiplication and getting

This commit is contained in:
Paolo Cignoni 2006-10-09 19:56:09 +00:00
parent d644daee6b
commit b9b2725478
1 changed files with 34 additions and 3 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $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 Revision 1.9 2004/09/30 00:48:07 ponchio
<gl/glew.h> -> <GL/glew.h> <gl/glew.h> -> <GL/glew.h>
@ -67,7 +70,7 @@ Revision 1.1 2004/03/31 15:27:17 ponchio
namespace vcg { namespace vcg {
inline void glMultMatrix(const Matrix44f &matrix) { inline void glMultMatrixE(const Matrix44f &matrix) {
//glMultMatrixf((const GLfloat *)(matrix[0])); //glMultMatrixf((const GLfloat *)(matrix[0]));
if(glMultTransposeMatrixf) glMultTransposeMatrixf((const GLfloat *)(matrix[0])); if(glMultTransposeMatrixf) glMultTransposeMatrixf((const GLfloat *)(matrix[0]));
else { else {
@ -77,8 +80,13 @@ inline void glMultMatrix(const Matrix44f &matrix) {
} }
} }
inline void glMultMatrix(const Matrix44d &matrix) { inline void glMultMatrix(const Matrix44f &matrix) {
// glMultMatrixd((const GLdouble *)(matrix[0])); Matrix44f tmp(matrix);
Transpose(tmp);
glMultMatrixf((const GLfloat *)(tmp[0]));
}
inline void glMultMatrixE(const Matrix44d &matrix) {
if(glMultTransposeMatrixd) glMultTransposeMatrixd((const GLdouble *)(matrix[0])); if(glMultTransposeMatrixd) glMultTransposeMatrixd((const GLdouble *)(matrix[0]));
else { else {
Matrix44d tmp(matrix); Matrix44d tmp(matrix);
@ -86,6 +94,19 @@ inline void glMultMatrix(const Matrix44d &matrix) {
glMultMatrixd((const GLdouble *)(tmp[0])); 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) { inline void glMultMatrix(const Similarityf &s) {
glTranslatef(s.tra[0], s.tra[1], s.tra[2]); 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){ inline void glGetv(const GLenum pname, Matrix44f & m){
glGetFloatv(pname,&m[0][0]); glGetFloatv(pname,&m[0][0]);
Transpose(m);
} }
inline void glGetv(const GLenum pname, Matrix44d & m){ inline void glGetv(const GLenum pname, Matrix44d & m){
glGetDoublev(pname,&m[0][0]); 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]);
} }