glRotated(x_Rot , 1.0, 0.0, 0.0);glRotated(y_Rot , 0.0, 1.0, 0.0);glRotated(z_Rot , 0.0, 0.0, 1.0);
slot_timer(){ y_Rot++; //меняем угол if(y_Rot >360) y_Rot = 0; updateGL(); //перерисовываем сцену}
C++ (Qt)#include <QGLWidget>#include <QTimer> class OGLPyramid : public QGLWidget {private:GLuint m_nPyramid;GLfloat m_xRotate;GLfloat m_yRotate;QPoint m_ptPosition;QTimer *timer;protected:virtual void initializeGL ();virtual void resizeGL (int nWidth, int nHeight);virtual void paintGL ();virtual void mousePressEvent(QMouseEvent* pe );virtual void mouseMoveEvent (QMouseEvent* pe );GLuint createPyramid (GLfloat fSize = 1.0f );public slots:void change();public:OGLPyramid(QWidget* pwgt = 0) ;}; ***.cpp#include <qevent.h> OGLPyramid::OGLPyramid(QWidget* pwgt/*= 0*/) : QGLWidget(pwgt), m_xRotate(0), m_yRotate(0){ timer = new QTimer; QObject::connect(timer,SIGNAL(timeout()),SLOT(change())); timer->start(500);}void OGLPyramid::change(){m_xRotate++;if(m_xRotate>360) m_xRotate=0;updateGL();}...void initializeGL (){...}void resizeGL (int nWidth, int nHeight){...} void paintGL (){...} void mousePressEvent(QMouseEvent* pe ){...} void mouseMoveEvent (QMouseEvent* pe ){m_xRotate += 180 * (GLfloat) (pe->y() - m_ptPosition.y () ) / height ();m_yRotate += 180 * (GLfloat)(pe->x() - m_ptPosition.x()) / width();updateGL();...}