We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1002

Summary: VSync is not activated under MacOS X Snow Leopard
Product: SDL Reporter: Vittorio Giovara <vitto.giova>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus
Version: 1.2.14   
Hardware: All   
OS: Mac OS X 10.6   

Description Vittorio Giovara 2010-05-10 14:39:56 UTC
the usual 1.2 way of enabling Vsync is not working since mac os x 10.6 came out
i don't know if it's a driver issue but just writing

        SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);

has no effect and a lot of tearing happens when using a gl context.
We found out the fix code in some python game in which they used

    one := 1;
    CGLSetParameter(CGLGetCurrentContext(), 222, @one);

to workaround it. Above code is in pascal and links agains the OpenGL library.
With this fix tearing never occurs under any mac version; i have untested if the problem also affects sdl 1.3, might be worth to try it.
Comment 1 Sam Lantinga 2011-02-16 04:17:25 UTC
This is working correctly in SDL 1.3.
Comment 2 Vittorio Giovara 2011-02-16 04:48:33 UTC
but isn't it worth to fix this bug in the sdl 1.2 branch?
Comment 3 Sam Lantinga 2011-02-16 05:02:10 UTC
Yes, but I won't have time to get to it for a while. :)
Comment 4 Ryan C. Gordon 2011-08-21 07:58:38 UTC
Is the concern that 1.2 isn't setting vsync at all, or it doesn't set vsync until you call SDL_SetVideoMode() again?

1.3 lets you toggle vsync on an existing context, 1.2 needs you to specify vsync preferences before setting the video mode.

(it's working here on Lion, fwiw: run test/testgl -sync, and you can see.)

--ryan.
Comment 5 Vittorio Giovara 2011-08-23 01:28:22 UTC
oh my bad, i was enabling SDL_GL_SWAP_CONTROL after creating the window
when enabled before, it works fine! thanks for pointing it out