increase FPS for QOpenGLWidget



  • Hi,

    I need to have 75 FPS to update my Oculus. So I connect a timer to the slot update but my FPS still limited at 60 FPS.

    this->time_.start();
    connect(&impl_->loopAt90FPS, SIGNAL(timeout()), this, SLOT(update()));
    this->loopAt75FPS.start(1000/75);
    
    
    void Viewer::paintGL() {
    // Render on HMD at 75 FPS
    qint64 time = impl_->time_.elapsed();
    
    this->currentScene_->update(time, time - impl_->lastTime_);
    this->currentScene_->renderOnHMD();
    this->currentScene_->render();
    
    this->lastTime_ = time;
    }
    

    regards,
    Robin


  • Moderators

    I'm not familiar with Oculus SDK but from what I understand you pass it a framebuffer with a context or something like that?
    If that's the case then the update rate will be capped at what can be handled by the display used to swap the buffers. Just a wild guess but you would need a separate (possibly shared) context in which you swap the buffers in a rate of the oculus device.



  • Yes, I compute two render to FBO (one per eye) and I send them to the oculus.
    My question is : why when I do this connect (connect(&this->loopAt75FPS, SIGNAL(timeout()), this, SLOT(update()));), my function paintGL is call at 60 FPS.

    I don't know how create two openGl context. :s


  • Moderators

    @Robinsondesbois said:

    why when I do this connect (connect(&this->loopAt75FPS, SIGNAL(timeout()), this, SLOT(update()));), my function paintGL is call at 60 FPS.

    update() does not do any painting. All it does is schedule a repaint. So it doesn't matter if you call it 75 or 10000 times a second. At some point your app gets back to the event loop and if an update event is pending it calls updateGL, which calls glDraw, which calls your paintGL. At the end of glDraw Qt waits for a v-sync and swaps buffers. This won't happen more often than a physical display refresh rate is, which is 60Hz for most consumer displays.

    As for context creation take a look at QOpenGLContext class and its swapBuffers method.



  • UpdateGL dosen't existe in QOpenGLWidget :s

    I look at QOpenGLContext. I can draw at 75 FPS my scene using swapBuffer and format.setSwapInterval(0); :)

    Thank a lot !
    Robin


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.