[PD] Syncing an event with refresh rate in GEM

Batuhan Bozkurt batuhan at batuhanbozkurt.com
Thu Oct 11 21:53:23 CEST 2007


Roman Haefeli wrote:
> On Thu, 2007-10-11 at 18:55 +0200, IOhannes m zmoelnig wrote:
>
>   
>> the next thing is to synchronize your trigger events with the gem-rendering.
>>
>>     
>
> while we are at: is there some way to hardsync Gem's framerate with the
> screen refresh rate? 
> i noticed, that when using [gemwin <screenrefreshrate>], both are quite
> in synch, but not really. i made a patch, that shows a part of an image
> with a very width. now, when scrolling the image from right to left with
> a counter, that is hardsynced to [gemhead], i still see some glitches,
> the scrolling is not stable in movement. 
> wouldn't it be cool, to have an option for [gemwin], that automatically
> hardsyncs it to screen refresh rate? [gemwin -1] ? is it possible at all
> to get 'screen clock' (i don't know how this is called correctly) on
> every os?
>
> roman
>
>   
I think this is called vsync(and seen as an option on some systems as 
''sync to vblank'').
And afaik this is not just tied to the software that is rendering things 
to screen but to the graphics card driver itself. I'm very frustrated 
about this in linux and windows.

First and foremost, Windows XP does not have vsync enabled on desktop, 
so when you move a window around you will see tearing on sides of 
windows. This is not enabled in XP and I don't know a way of enabling it 
actually. I've heard that there was a beta of XP where vsync was enabled 
as default so I think this is a choice of developers(as it affects 
performance afair).
And GEM is not synced too. You can try with the attached patch. I found 
no ways of enabling it for OpenGL applications. (I think vista has it 
enabled by default, did not try it though)

In linux, that is another story. Vsync is not enabled by default. You 
need to have direct rendering enabled to have vsync enabled. If you have 
a ATI graphics card with closed source drivers and you are using 
compositing(via XGL), that is not possible. If you are not using XGL, it 
is not enabled as default. If you have direct rendering enabled, you can 
use a tool called ''driconf'' to enable vsync. When you enable it, 
regular desktop is still not synced(move windows and you will see 
tearing). But GEM(and opengl) will be synced as they are using direct 
rendering. So you will be fine.

On Macos, vsync is enabled both on desktop and opengl by default. It 
looks smooth and nice, because of that. So you won't see any tearing 
whatsoever on your desktop or in GEM. This is really nice.

You can see the attached example to see if you have vsync on or off. If 
you are synced, the bar will move smoothly. If not, you will see tearing 
in movement.

In my experiments, XP had tearing and I had no fix, in Ubuntu Linux, 
tearing by default but can be fixed by driconf, and in osx there were no 
problems.

Batuhan

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: synctest.pd
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20071011/02ab0b93/attachment.txt>


More information about the Pd-list mailing list