Difference between ofGetScreenWidth(), ofGetWidth(), and ofGetWindowWidth()?

There are so many methods to get height and width, not sure when to use which. The ofGetWindowWidth() seems to be updated faster than the other two but I am not sure?

1 Like

ofGetWindowWidth && ofGetWidth should return the same thing; the size of the window. ofGetScreenWidth() returns the resolution of your screen.

So if you have a 1650x1080 screen and an OF window size of 1200x800, ofGetWidth() && ofGetWindowWidth() will return 1200 and ofGetScreenWidth() will return 1650.


I believe ofGetWidth is corrected for FBOs, viewport and orientation.
So if you are drawing into an FBO, ofGetWidth will return the width of the FBO.
ofGetWindowWidth will still return the window size regardless.

Normally though ofGetWidth and ofGetWindowWidth are the same.

Cool thanks guys!