Results 1 to 6 of 6

Thread: OpenGL in thread

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2008
    Location
    Algarve, Portugal
    Posts
    288
    Thanks
    23
    Thanked 32 Times in 28 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: OpenGL in thread

    did you use timers ?
    __________________________________________________
    My projects: calculator MathGraphica ; SuperEpicMegaHero game ; GooglePlay ; bitbucket ; github
    Like my projects ? Buy me a kofi

  2. #2
    Join Date
    Nov 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: OpenGL in thread

    Quote Originally Posted by john_god View Post
    did you use timers ?
    I tried with timers and now it works. This is what I have in the thread now:
    Qt Code:
    1. void GLThread::start_simulation()
    2. {
    3. connect(simtimer, SIGNAL(timeout()), this, SLOT(rotateOneStep()));
    4. simtimer->start(1);
    5. }
    To copy to clipboard, switch view to plain text mode 

    where:
    Qt Code:
    1. void GLThread::rotateOneStep()
    2. {
    3. i=i+Tspeed;
    4. emit changeVal(i);
    5. }
    To copy to clipboard, switch view to plain text mode 
    changeVal signal is connected with the openGL function which executes the rotation and has the updateGL() at the end.

    Is this the only way to do this? or is it the best way?

  3. #3
    Join Date
    Aug 2008
    Location
    Algarve, Portugal
    Posts
    288
    Thanks
    23
    Thanked 32 Times in 28 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: OpenGL in thread

    I'm not sure but I think you should put glClear(...) in the initializeGL() function.
    No need to keep calling it in paintGL() as you update drawings.
    __________________________________________________
    My projects: calculator MathGraphica ; SuperEpicMegaHero game ; GooglePlay ; bitbucket ; github
    Like my projects ? Buy me a kofi

Similar Threads

  1. Thread Ownership Problem
    By tntcoda in forum Qt Programming
    Replies: 1
    Last Post: 9th June 2009, 00:18
  2. OpenGL and Qt Question
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 18th April 2009, 18:04
  3. QT + OpenGL + Thread => aaaahhhhh !
    By anthibug in forum Qt Programming
    Replies: 7
    Last Post: 26th July 2008, 13:36
  4. Qtopia Core & OpenGL ES?
    By zelko in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 28th May 2007, 07:21
  5. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13

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
  •  
Qt is a trademark of The Qt Company.