View Issue Details

IDProjectCategoryView StatusLast Update
0000777FSSCPOpenGLpublic2006-02-24 06:40
ReporterMuriac Assigned Totaylor  
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Summary0000777: Vertical Sync would be really nice
DescriptionTearing is sometimes very apparent in the Mac OS X build, and an option to synchronize frame updates with screen refresh rates would make the game look much better.
TagsNo tags attached.

Activities

taylor

2006-02-21 06:39

administrator   ~0004875

I'm not really sure of how to do this in OS X (as I'm very new to Mac programming) but I think that someone has asked for a settable FPS cap anyway. That way you could limit the FPS to what ever you want and not worry about v-sync. This would be a simple registry/ini setting called "MaxFPS" and would just cap the FPS somewhere between 30 and 120. I think that the original request was for a cmdline option but this really isn't something that you would be changing often (I hope anyway), plus we already have enough cmdline options.

As long as I can remember to do that, this will be in the next OS X CVS build that should come out by Friday. I'll update here when the build is available and you can give it a try to make sure it solves your problem.

Muriac

2006-02-21 11:32

reporter   ~0004877

Cool, thanks. Is an FPS cap an adequate solution, though? Even if the framerate is lower than the screen refresh rate, there's no guarantee that new frames will be draw in-sync with screen refreshes. Vertical sync is about holding new frames until a new refresh in order to avoid the "tearing" appearance of a single refresh being made of the halves of two different frames. I'm out of my league, here, but isn't that done with double buffering, or something?

phreak

2006-02-21 16:31

developer   ~0004882

In OpenGL, i believe that VSync is handled through a bunch of OS-specific extensions (WGL_EXT_SWAP_CONTROL for windows IIRC), so its not as easy to enable as it would be in D3D.

taylor

2006-02-21 16:57

administrator   ~0004885

Right, the FPS cap is not going to be as good as just using v-sync. But as phreak said, it's platform specific which makes things a bit more difficult to do properly. It's easier under Windows since there is a specific extension for it, under Linux it's easily a driver thing, and I have no idea about OS X. Handling it at the driver/OS level is easier but that's up to the end user to deal with.

If you can point out some docs for doing it properly under OS X I'll certainly take a look at them, but I haven't found anything yet from my own searches.

Muriac

2006-02-21 18:16

reporter   ~0004889

Understood. Thanks for looking into it. I doubt I'll find anything, but I'll take a look anyway.

phreak

2006-02-21 22:04

developer   ~0004891

GLX_SGI_video_sync may be extension for v-sync in an x-windows environment. Dunno for sure as I can't test it.

http://oss.sgi.com/projects/ogl-sample/registry/SGI/video_sync.txt

taylor

2006-02-21 22:31

administrator   ~0004892

That works fine for X, but under Linux you can usually just use a env variable to do the same thing outside of code. The Linux crowd doesn't seem to care all that much about this though so it's not really a priority to fix it for us.

If I just can figure out how to do the same basic thing for OS X then I would add this functionality to the code. The Apple GL extension guide doesn't appear to have anything, and a search hasn't turned up anything yet. AGL does have this ability but we are using normal OpenGL and I haven't seen the same type of setting yet.

Muriac

2006-02-22 01:44

reporter   ~0004893

I asked at Ars and got this: http://episteme.arstechnica.com/groupee/forums/a/tpc/f/6330927813/m/578003687731

taylor

2006-02-22 02:36

administrator   ~0004894

EXACTLY what I was looking for! :D And it was easy enough to code in. ;)

I've got the GLX side done and after I do the WGL side I'll go ahead and commit this. Vsync will be enabled by default (like with D3D under Windows) but can be disabled with the -no_vsync cmdline option. I'll get all of this in for the next OS X build at least. Look for that on Thursday. And thanks for finding the answer!

Muriac

2006-02-23 03:20

reporter   ~0004899

Checking that thread again, someone pointed out that the thread will block while waiting for vsync, and that you might want to have another thread doing something useful in that time. Dunno if that helps.

taylor

2006-02-24 06:40

administrator   ~0004917

Should be good to go in CVS now. If I get the chance to compile and upload a new OS X build before I pass out then look for it in the normal place I put them. It will likely be tomorrow at some point before I can upload the build though.

If it doesn't work for you for some reason (it passed my tests so I'm pretty sure it's fine) then just reopen this bug.

taylor

2006-02-24 06:40

administrator   ~0004918

Fixered.

Issue History

Date Modified Username Field Change
2006-02-02 04:27 Muriac New Issue
2006-02-21 06:39 taylor Note Added: 0004875
2006-02-21 11:32 Muriac Note Added: 0004877
2006-02-21 16:31 phreak Note Added: 0004882
2006-02-21 16:57 taylor Note Added: 0004885
2006-02-21 18:16 Muriac Note Added: 0004889
2006-02-21 22:04 phreak Note Added: 0004891
2006-02-21 22:31 taylor Note Added: 0004892
2006-02-22 01:44 Muriac Note Added: 0004893
2006-02-22 02:36 taylor Note Added: 0004894
2006-02-22 02:36 taylor Status new => assigned
2006-02-22 02:36 taylor Assigned To => taylor
2006-02-23 03:20 Muriac Note Added: 0004899
2006-02-24 06:40 taylor Note Added: 0004917
2006-02-24 06:40 taylor Status assigned => resolved
2006-02-24 06:40 taylor Resolution open => fixed
2006-02-24 06:40 taylor Note Added: 0004918