demos/boxes/scene.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 3 41300fa6a67c
equal deleted inserted replaced
3:41300fa6a67c 4:3b1da2848fc7
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the demonstration applications of the Qt Toolkit.
     7 ** This file is part of the demonstration applications of the Qt Toolkit.
     8 **
     8 **
   651     m_renderOptions->emitParameterChanged();
   651     m_renderOptions->emitParameterChanged();
   652 }
   652 }
   653 
   653 
   654 static void loadMatrix(const QMatrix4x4& m)
   654 static void loadMatrix(const QMatrix4x4& m)
   655 {
   655 {
   656     GLfloat mat[16];
   656     // static to prevent glLoadMatrixf to fail on certain drivers
       
   657     static GLfloat mat[16];
   657     const qreal *data = m.constData();
   658     const qreal *data = m.constData();
   658     for (int index = 0; index < 16; ++index)
   659     for (int index = 0; index < 16; ++index)
   659         mat[index] = data[index];
   660         mat[index] = data[index];
   660     glLoadMatrixf(mat);
   661     glLoadMatrixf(mat);
   661 }
   662 }
   662 
   663 
   663 static void multMatrix(const QMatrix4x4& m)
   664 static void multMatrix(const QMatrix4x4& m)
   664 {
   665 {
   665     GLfloat mat[16];
   666     // static to prevent glMultMatrixf to fail on certain drivers
       
   667     static GLfloat mat[16];
   666     const qreal *data = m.constData();
   668     const qreal *data = m.constData();
   667     for (int index = 0; index < 16; ++index)
   669     for (int index = 0; index < 16; ++index)
   668         mat[index] = data[index];
   670         mat[index] = data[index];
   669     glMultMatrixf(mat);
   671     glMultMatrixf(mat);
   670 }
   672 }