Results 1 to 2 of 2

Thread: OpenGL app at full speed? Can you do it?

  1. #1

    Default OpenGL app at full speed? Can you do it?

    I was looking at the Qt library of OpenGL samples, but see that I think they have the same problem that wxWidgets does. Basically, all OpenGL updates need to be triggered by a timer event. For example:
    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(rotateOneStep()));
    timer->start(20);

    The rotateOneStep function then calls update/paint on the OpenGL context. The problem I have is that I want to run at the max FPS I can get. Usually, one does this in the WinMain or other message pump loop:
    while()
    {
    processmessage();
    dispatchmessage();
    drawscene();
    }

    Is there a way to do this in Qt?
    Thanks in advance,

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: OpenGL app at full speed? Can you do it?

    all OpenGL updates need to be triggered by a timer event.
    What makes you think that?
    You can call your update function in any way you choose.

    I am not sure what is the problem you are trying to describe.
    you can call the update function that will update your opengl context be it with a timer or any other means as fast as the system time resolution.
    If what ever you are drawing is beyond just filling the screen with one color (and usually you will have a scene that is larger then few pixels), the drawing will be slower then your update call rate, even on the fastest hardware.

    The example you gave used a trigger for updating - based on the changes done in the scene, and not to have contentious "video" in max speed...
    For example, a frame rate of 500 fps will mean an update every 2ms, which is no problem on the systems side, the question is if the graphic card can do your scene in 2 ms.

    So, to your question, yes, there is a way to do it in Qt - but it has nothing to do with Qt.
    You can do it with a thread that will loop and only call your update function, for example.
    The speed will be determined only by the time it takes for your update function to return.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. OpenGL and Qt Question
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 18th April 2009, 18:04
  2. Qtopia Core & OpenGL ES?
    By zelko in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 28th May 2007, 07:21
  3. Replies: 0
    Last Post: 4th May 2007, 10:44
  4. OpenGL ES, Qt/11 - Qtopia Core?
    By zelko in forum Qt Programming
    Replies: 0
    Last Post: 3rd May 2007, 10:56

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.