Solved Increase Frame Rate
-
Hi,
I want to increase my frame rate. It's native fixe to 60 FPS. I need to have 75 FPS for Oculus.
Best regards,
Robin -
How is your question related to Qt?
What device is that? -
Yes you're right. I send you some more contexte.
I use the OpenGL tutorial of Qt5.5 to work (http://doc.qt.io/qt-5/qtgui-openglwindow-example.html). So I have this class :
class OpenGLWindow : public QWindow, protected QOpenGLFunctions_4_1_Core
{
Q_OBJECT
public:
explicit OpenGLWindow(QWindow *parent = 0);
~OpenGLWindow();virtual void render(QPainter *painter); virtual void render(); virtual void initialize(); void setAnimating(bool animating); QOpenGLContext* GetContexte();
public slots:
void renderLater();
void renderNow();protected:
bool event(QEvent *event) Q_DECL_OVERRIDE;void exposeEvent(QExposeEvent *event) Q_DECL_OVERRIDE;
private:
bool m_update_pending;
bool m_animating;QOpenGLContext* m_context; QOpenGLPaintDevice* m_device;
};
I set the boolean animation to true. And this function call my randerer at 60 FPS. I want to increase this value to 75 FPS.
void OpenGLWindow::renderNow()
{
if (!isExposed())
return;bool needsInitialize = false; if (!m_context) { m_context = new QOpenGLContext(this); m_context->setFormat(requestedFormat()); m_context->create(); needsInitialize = true; } m_context->makeCurrent(this); if (needsInitialize) { initializeOpenGLFunctions(); initialize(); } render(); m_context->swapBuffers(this); if (m_animating) renderLater();
}
-
Ok,
So I put the Swap Interval to 0 and I use a QTimer like this :QTimer *timer = new QTimer(); connect(timer, SIGNAL(timeout()), this, SLOT(renderLater())); timer->start(1000/75);
And it's works ^^