title: Qt OpengL - Rotation of a 3D fixed scene
body: <p>I am working on a Qt/GPU/OpenCL code with OpenGL rendering. It performs an animation of a 3D scene and I succeed in rotating this 3D scene with mouse while the animation. But the rotation doesn't work when I do a pause of the animation, i.e when the 3D scene is "fixed".</p>
  
  <p>here's the two functions for the rotation with mouse :</p>
  
  <pre><code>void GLWidget::mousePressEvent(QMouseEvent *event)
   {
       lastPos = event-&gt;pos();
   }
  
   void GLWidget::mouseMoveEvent(QMouseEvent *event)
   {
       float dx = (event-&gt;y() - lastPos.y()) / 10.0f;
       float dy = (event-&gt;x() - lastPos.x()) / 10.0f;
       float dz = 0.0f;
       float angle = sqrtf((event-&gt;x() - lastPos.x()) + (event-&gt;y() - lastPos.y()));
  
       if (event-&gt;buttons() &amp; Qt::LeftButton) {
          angle = sqrtf(dx*dx + dy*dy);
          glRotatef(0.1*angle, dx, dy, dz);
         }
   }
  </code></pre>
  
  <p>When the animation is on "pause", I would like to be able to rotate the fixed scene and when I push the "restart" button, I would like the animation restarts with the last modified image done by the rotation of the scene.</p>
  
  <p>So, this should be, before to do "pause", like a snapshot of the last animation, then the possiblity to rotate, and finally, restart the animation from the last 3D rotated scene.</p>
  
  <p>Here's my main display function "<code>processCurrent()</code>" called by a QTimer and where <code>"draw()"</code> contains OpenGL functions and <code>animation</code> is set to <code>false</code> when I do a pause :</p>
  
  <pre><code> void GLWidget::processCurrent()
  {
  
   if (Galaxy-&gt;isFirstLaunch)
      {
      draw();
      printStats();
      //Calling kernel for calculatig subsequent positions
      Galaxy-&gt;runCLKernels();
      Galaxy-&gt;isFirstLaunch = false;
      glFlush();
      swapBuffers();
      }
  
   if (animation)
      {
      clWaitForEvents(1, &amp;Galaxy-&gt;glEvent);
      draw();
      printStats();
      //Calling kernel for calculatig subsequent positions
      Galaxy-&gt;runCLKernels();
      glFlush();
      swapBuffers();
     }
  
  }
  </code></pre>
  
  <p>Could you explain me why this rotation doesn't work with a fixed scene ?</p>