Fullscreen performance & ofGetHeight/Width

I’ve got a project I’m maintaining that started in OF 0.8 (maybe even 0.7). I’m using OS X Xcode 7 for development now and I’ve updated the OF library to 0.9.3. Everything is great using OF_WINDOW.

If I try to run OF_FULLSCREEN I get horrible FPS (about 8) even with vsync off. If I profile with Instruments, it looks like all the CPU time is going to ofGetWidth and ofGetHeight calls. I’ve tested example projects, and they seem fine, so I’m probably doing something wrong.

Could it be:

  • Something I’ve missed in the changelog?
  • Something related to Retina screens on Macs?
  • Vsync not actually turning off?
  • A rendering problem? (Resolution doesn’t seem to be an issue, as rendering at arbitrarily high resolutions like 4k is fine in a window.)
  • Something dumb I did to fix something in an old OF version that is now ruining this new OF version?

i remember we fixed a similar issue a while ago and now ofGetWidth/Height are only returning a variable cause it was kind of slow to query glfw every call so not sure why it would be slow now.

if you are calling those functions a lot of times in a loop or something every frame try storing the values in a variable outside the loop and then using it from the variable instead of calling the functions evertyime

1 Like

Cool, thanks Arturo. I’ll try making that change.

just stumbled across this issue - and yes, replacing ofGetWidth()/ofGetheight() with (local) variables does solve it for me. (This is on Linux, Intel Broadwell GT2)