Quote Originally Posted by wysota View Post
No, by using threads... Contrary to what people think threads tend to slow down execution of code, not speed it up. Unless of course you have more processing units than threads in your application and no other cpu consuming task is running.
I completely agree, you misunderstand me !
Re-read what i said : i'm slowing my application
Not solving, slowing ! Sorry for my english...



Quote Originally Posted by wysota View Post
Quote Originally Posted by TiTi
But i really don't care here, it's just for launching a camera motion move and having the ability to play/pause that.
What do you use threads for, anyway?
Yep that was not really explicit, give me another chance :
-my gldrawer is in the same thread than the gui
-i want to launch a processing to take screenshots from A point to B point into the cloud points scene
-if i do that from the `main` thread, i'm freezeing my application : no buttons anymore, no resize, etc... or crash
I've to wait until the end of animation and cross finger that a crash doesn't happend cause of events.

=> so my idea was to create a second thread from which the translation of the camera is done in an infinite loop


Quote Originally Posted by wysota View Post
Why should it draw all the time? It doesn't make sense as the movement (not redrawing) depends on the other tasks running on your machine. You should first run a benchmark to determine how fast you can draw and then adjust the timer so that you have a constant frequency of the "game loop" and redraw as often as you know is possible.
-it's not a game but i think you know that
-why draw all the time : because, as you said : "updateGL has to be called in the main thread"
=>with the second thread looping and moving the camera, the only way to refresh the screen was to draw from the first thread.
I'm also re-saying : i don't care to use a timer with a 0ms delay that take 100% of one core of my CPU.

-in the latest modifications, i'm using a QMutex and a QWaitCondition* in a way that the second thread wait that the first thread do all the painting [wakeAll() after updateGL()]

Of course the animation is not perfectly fluid, but i don't care because i just need to take the screenshot of the gl surface at every frame , i'm going to recompose a video from the captures. (I'm doing that because the scene is huuuuuuuuuuuge). [yes i know i didn't clearly explain all of that, but i aldready said a lot...]

So this way i'm minimazing the call in terms of 'redrawing'...


Sure it appears pretty messed up from your eye, and i'm far from beeing a pro at QT+OpenGL+Huge scenes... Even more far from beeing a good teller..
So as a novice, who knew nothing a few weeks ago, it was hard to figure it out and explain my problem(s) but I manage to resolve them.

I'm assuring you this thread animation thing is just one of the functionnalities ; it's not impacting the viewer in itself, with the free fly camera.



*about that i can't find QWaitCondition in the assistant, only found here : http://doc.trolltech.com/4.4/qwaitcondition.html