resize callback

It would be nice to have access to a resize event:

virtual void resize(int w, int h) {}

in the ofSimpleApp in the next version to check if the window size has changed for example after going fullscreen.

To accomplish this I added a little bit of code to ofAppGlutGlue:

void resize(int w, int h) {
OFSAptr->resize(w,h);
}

and this to ofAppRunner in the ofRunApp function:

glutReshapeFunc(resize);

nice request, and nice solution - we will plug it in for sure

thanks!!
zach

i suppose this one didn’t make it into 0.05… to bad… :slight_smile:

nope, I’m sorry, there was a lot to do and somehow this didn’t make it onto our change list -

it’ll get into 0.06 for sure…

currently, if you keep track of previous width and height of the screen, you can do something along these lines:

  
  
int curWidth = ofGetHeight();  
int curHeight = ofGetHeight();  
if (curWidth != prevWidth || curHeight != prevHeight){  
 /// we've resized!!!!  
}  
prevWidth = ofGetWidth();  
prevHeight = ofGetHeight();  
  

which could be an OK temporary solution…

take care!
zach

[quote author=“companje”]It would be nice to have access to a resize event:

virtual void resize(int w, int h) {}

in the ofSimpleApp in the next version to check if the window size has changed for example after going fullscreen.[/quote]

Not only nice, but necessary. Look what happens when using the accumulation buffer and not having a resize callback!

Yes, garbled output!

Getting hold of the resize, as a windowWillResize-type notification would be really useful, so that it can be determined whether resizing should occur based on given criteria.

Just a thought.