Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Increase Frame Rate
QtWS25 Last Chance

Increase Frame Rate

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 3.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      How is your question related to Qt?
      What device is that?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        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();
        

        }

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          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 ^^

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved