Turning vsync off in OSX doesn't work

Hey everyone

I’ve got an empty project set up on OSX 10.10, and I’m setting ofSetVerticalSync(false) in the setup() function. The problem is that it is reporting 60fps solid with ofGetFrameRate(), even though ofGetTargetFrameRate() gives me 480fps.

Not sure what I’m doing wrong!

(I’m developing for a high-framerate target, I need it to run faster than 60fps).

are you plugged into a devices? is this on a laptop?

This is on a laptop. No devices, just native target on the laptop monitor.

what version of OF ? What version OSX? what laptop / graphics card? If you are on a latop with switchable graphics, what card? (you can use a utility called gfxStatus to tell you more info)

can you try altering main.cpp to use glut instead of glfw, I’m curious if this has an impact – I’m not seeing this, on 10.9 / 0.84…

#include "ofMain.h"
#include "ofApp.h"
#include "ofAppGlutWindow.h"

//========================================================================
int main( ){
    
    ofAppGlutWindow window;  
    ofSetupOpenGL(&window, 1920,1080,OF_WINDOW);

feel free to post up sample code too, I’m happy to see if something looks weird…

Sure, thanks for your help.

This is on 10.10.2 on a 15" retina Macbook Pro (mid-2012). Openframeworks 0.8.4

I tried using gfxStatus to run it using both integrated and discrete graphics, no change. And I tried using glut instead of glfw and it didn’t change anything either.

The code is very short - I used the project generator to make a blank project, then I added this to main.cpp

int main(){
    ofSetupOpenGL(1024,768,OF_WINDOW);
    ofSetFrameRate(480);
    ofSetVerticalSync(false);
    ofRunApp(new ofApp());
}

and this to ofApp.cpp:

void ofApp::draw(){
    ofDrawBitmapString(ofToString(ofGetFrameRate())+"fps", 10, 15);
}

That’s all I did! The app seems to start at 480fps but after about half a second it stabilizes down to solid 60fps. Behaves the same way in full screen mode.

I definitely don’t see the same thing here – tried a bunch of things but it’s all working aok for me.

this SO post seems somewhat promising:

here’s how to do it the apple way, worth a shot:

#include "ofApp.h"
#include <Carbon/Carbon.h>
#include <OpenGL/OpenGL.h>

 .....

//--------------------------------------------------------------
 void ofApp::keyPressed(int key){

    const GLint VBL = 0;
    CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &VBL);
}

that doesn’t work either, sadly. Oh well, thanks for your help.

Ah, it turns out that 10.10 forces vsync on by default (only they call it ‘beamsync’ so you have no hope of googling it). I disabled it using a utility called ‘beamoff’, works fine.

oh how weird ! someone pointed this out to me the other day, maybe helpful ?

yeah, what you were describing sounds similar to what I’ve seen on windows where overall system settings over-ride the applications choice.

So thaaaaaaats why… I thought I was going crazy. Thanks for the references.

ofxBeamSyncDropper works great, thanks zach!