Adding high-level method for glLoadMatrix

icc-effect-5.14.5
Martin Gräßlin 2011-01-01 18:55:51 +01:00
parent e49345872c
commit efb82daf30
2 changed files with 24 additions and 0 deletions

View File

@ -351,6 +351,22 @@ void multiplyMatrix(const QMatrix4x4 &matrix)
#endif #endif
} }
void loadMatrix(const QMatrix4x4 &matrix)
{
#ifdef KWIN_HAVE_OPENGLES
Q_UNUSED(matrix)
#else
GLfloat m[16];
const qreal *data = matrix.constData();
for (int i = 0; i < 4; ++i) {
for (int j=0; j < 4; ++j) {
m[i*4+j] = data[i*4+j];
}
}
glLoadMatrixf(m);
#endif
}
void popMatrix() void popMatrix()
{ {
#ifndef KWIN_HAVE_OPENGLES #ifndef KWIN_HAVE_OPENGLES

View File

@ -151,6 +151,14 @@ KWIN_EXPORT void pushMatrix(const QMatrix4x4 &matrix);
* @since 4.7 * @since 4.7
**/ **/
KWIN_EXPORT void multiplyMatrix(const QMatrix4x4 &matrix); KWIN_EXPORT void multiplyMatrix(const QMatrix4x4 &matrix);
/**
* Replaces the current matrix on GL stack with @p matrix.
* In GLES this method is a no-op. This method should be preferred over glLoadMatrix
* as it also handles GLES.
* @param matrix The new matrix to replace the existing one on the GL stack.
* @since 4.7
**/
KWIN_EXPORT void loadMatrix(const QMatrix4x4 &matrix);
/** /**
* Pops the current matrix from the GL matrix stack. * Pops the current matrix from the GL matrix stack.
* In GLES this method is a noop. This method should be preferred over glPopMatrix * In GLES this method is a noop. This method should be preferred over glPopMatrix