From: Christian Beaudoin (Christian.Beaudoin++at++irdpq.qc.ca)
Date: 08/16/2004 07:02:35
Could the use of a mutex resolve the problem ?
For example, I have a pthread running the application main loop doing
pfFrame and another updating the position DCS of my objects. I would do
it like this:
In main loop:
pfSync()
Do some stuff;
pthread_mutex_lock( & mutex );
pfFrame()
pthread_mutex_unlock( & mutex );
In my other thread:
Do some other stuff;
pthread_mutex_lock( & mutex );
update the DCS
pthread_mutex_unlock( & mutex );
But I worry that it perturbates the framerate.
I ask the question because I don't have access to the application main
loop's code and I must be sure of the right solution before to ask the
company for changing this code.
Thanks,
Christian
MLM Veraart wrote:
>Christian Beaudoin wrote:
>
>
>>Hello,
>>
>>When I give a displacement to an object in my scene, it's movement seems
>>irregular.
>>
>>For example, a car running on a street appears to do some jumps in its
>>postion.
>>
>>As another example: I made an advise (a panel) appear on the screen
>>while the person is running into a scene. I want the panel to stay in
>>front of the person while she continues running, and I give it the
>>position of the camera + a small ofset along the Z axis. The problem is
>>that the panel is doing some jumps and it is very boring for realism
>>cause our application is in virtual reality.
>>
>>But, the movment is generated by a thread who is executed at a frequency
>>of 172 Hz . So, 172 times per second the DCS matrix of the object is
>>updated. That way, the movment should appear fluid if I consider that
>>the refresh rate of the scene is about 30 Hz.
>>
>>The problem appears worst when I use stereo vision; te jumps are still
>>more frequent.
>>
>>It sounds like a lack of synchronisation between he time the obect
>>position is updated and the time where the camera position is updated or
>>somehing like that.
>>
>>Is threre a secret of video games to vercome that problem ? Would the
>>fact to use a pfFCS instead of a pfDCS resolve my problem ?
>>
>>Any trick would be welcome,
>>
>> Chrisian
>>
>>
>>
>
>It depends on where you update the channel view position and where you update the DCS.
>If you calculate them once every frame, between pfFrame and pfSync, based on the
>same input data then you should have perfect correlation and no jumping.
>If the calculation is not time consuming you can do it in between pfSync and pfFrame.
>But update view and DCS based on the same movement state.
>
>An other possibility is to use a second channel that only contains the panel geometry in
>its scene.
>It is added to the pipe after the main channel. In the draw callback you disable the
>clearing of the frame buffer so you can draw over the existing main view. You can make
>this an orthographic channel for easy drawing and modelling. With this solution you NEVER
>have any jump.
>
>Mario
>
>
>
This archive was generated by hypermail 2b29 : Mon Aug 16 2004 - 07:09:23 PDT