Commit 866b1564 authored by Martin Flöser's avatar Martin Flöser
Browse files

Adding high-level method for glLoadMatrix

parent 0379afb7
......@@ -351,6 +351,22 @@ void multiplyMatrix(const QMatrix4x4 &matrix)
#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()
{
#ifndef KWIN_HAVE_OPENGLES
......
......@@ -151,6 +151,14 @@ KWIN_EXPORT void pushMatrix(const QMatrix4x4 &matrix);
* @since 4.7
**/
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.
* In GLES this method is a noop. This method should be preferred over glPopMatrix
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment