diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/opengl/pbuffers/cube.cpp | 20 | ||||
-rw-r--r-- | examples/opengl/shared/qtlogo.cpp | 20 | ||||
-rw-r--r-- | examples/widgets/graphicsview/boxes/scene.cpp | 16 |
3 files changed, 5 insertions, 51 deletions
diff --git a/examples/opengl/pbuffers/cube.cpp b/examples/opengl/pbuffers/cube.cpp index e384078b7d..91024fc3cd 100644 --- a/examples/opengl/pbuffers/cube.cpp +++ b/examples/opengl/pbuffers/cube.cpp @@ -121,24 +121,6 @@ void Tile::setColors(GLfloat colorArray[4][4]) geom->setColors(start, colorArray); } -static inline void qMultMatrix(const QMatrix4x4 &mat) -{ - if (sizeof(qreal) == sizeof(GLfloat)) - glMultMatrixf((GLfloat*)mat.constData()); -#ifndef QT_OPENGL_ES - else if (sizeof(qreal) == sizeof(GLdouble)) - glMultMatrixd((GLdouble*)mat.constData()); -#endif - else - { - GLfloat fmat[16]; - qreal const *r = mat.constData(); - for (int i = 0; i < 16; ++i) - fmat[i] = r[i]; - glMultMatrixf(fmat); - } -} - void Tile::draw() const { QMatrix4x4 mat; @@ -146,7 +128,7 @@ void Tile::draw() const mat.rotate(orientation); glMatrixMode(GL_MODELVIEW); glPushMatrix(); - qMultMatrix(mat); + glMultMatrixf(mat.constData()); glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, faceColor); glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, geom->indices() + start); glPopMatrix(); diff --git a/examples/opengl/shared/qtlogo.cpp b/examples/opengl/shared/qtlogo.cpp index 1a3b94eff0..d3ccb7ac99 100644 --- a/examples/opengl/shared/qtlogo.cpp +++ b/examples/opengl/shared/qtlogo.cpp @@ -173,29 +173,11 @@ void Patch::translate(const QVector3D &t) mat.translate(t); } -static inline void qMultMatrix(const QMatrix4x4 &mat) -{ - if (sizeof(qreal) == sizeof(GLfloat)) - glMultMatrixf((GLfloat*)mat.constData()); -#ifndef QT_OPENGL_ES - else if (sizeof(qreal) == sizeof(GLdouble)) - glMultMatrixd((GLdouble*)mat.constData()); -#endif - else - { - GLfloat fmat[16]; - qreal const *r = mat.constData(); - for (int i = 0; i < 16; ++i) - fmat[i] = r[i]; - glMultMatrixf(fmat); - } -} - //! [2] void Patch::draw() const { glPushMatrix(); - qMultMatrix(mat); + glMultMatrixf(mat.constData()); glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, faceColor); const GLushort *indices = geom->faces.constData(); diff --git a/examples/widgets/graphicsview/boxes/scene.cpp b/examples/widgets/graphicsview/boxes/scene.cpp index 5fb43d8c99..cf0b021b47 100644 --- a/examples/widgets/graphicsview/boxes/scene.cpp +++ b/examples/widgets/graphicsview/boxes/scene.cpp @@ -655,22 +655,12 @@ static void loadMatrix(const QMatrix4x4& m) { // static to prevent glLoadMatrixf to fail on certain drivers static GLfloat mat[16]; - const qreal *data = m.constData(); + const float *data = m.constData(); for (int index = 0; index < 16; ++index) mat[index] = data[index]; glLoadMatrixf(mat); } -static void multMatrix(const QMatrix4x4& m) -{ - // static to prevent glMultMatrixf to fail on certain drivers - static GLfloat mat[16]; - const qreal *data = m.constData(); - for (int index = 0; index < 16; ++index) - mat[index] = data[index]; - glMultMatrixf(mat); -} - // If one of the boxes should not be rendered, set excludeBox to its index. // If the main box should not be rendered, set excludeBox to -1. void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox) @@ -722,7 +712,7 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox) glPushMatrix(); QMatrix4x4 m; m.rotate(m_trackBalls[1].rotation()); - multMatrix(m); + glMultMatrixf(m.constData()); glRotatef(360.0f * i / m_programs.size(), 0.0f, 0.0f, 1.0f); glTranslatef(2.0f, 0.0f, 0.0f); @@ -755,7 +745,7 @@ void Scene::renderBoxes(const QMatrix4x4 &view, int excludeBox) if (-1 != excludeBox) { QMatrix4x4 m; m.rotate(m_trackBalls[0].rotation()); - multMatrix(m); + glMultMatrixf(m.constData()); if (glActiveTexture) { if (m_dynamicCubemap) |