Quantcast
Channel: bugs, errors - openFrameworks
Viewing all articles
Browse latest Browse all 636

Drastic Slow Down on calls to ofGetHeight() or ofGetWidth() in full screen?

$
0
0

@ttyy wrote:

This seems like an odd bug:

When in fullscreen mode, a for loop that uses ofGetWidth() and/or ofGetHeight() will slow my app to a crawl.

I'm using oF 0.9.3 on OSX 10.11

Here is the code I'm testing:

//--------------------------------------------------------------
void ofApp::draw(){

    for (int x = 0; x < ofGetWidth(); x += 20) {
        // do nothing
    }

    ofDrawBitmapString(ofToString(ofGetFrameRate()),10,10);
}

//--------------------------------------------------------------
void ofApp::keyPressed(int key){
    if (key == 'f') ofToggleFullscreen();
}

If I run the app in window mode, it runs at 60fps, but if I toggle to fullscreen, it slows to 13fps.

If I switch ofGetWidth() for a constant (i.e. 1920), I get 60fps in fullscreen.

Any ideas?

I should mention I've tested this on my Retina MacBook Pro display and on at 1080p external monitor with identical results.

Thanks

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 636

Trending Articles