Refreshing a window during a resize event

nobody wrote on Sunday, September 04, 2005:

Hello everyone!

Suppose we have following code:

void GLFWCALL windowResize( int w, int h )
{
glClear( GL_COLOR_BUFFER_BIT );
std::cout << w << ’ ’ << h << std::endl;
// glfwSwapBuffers /* 1 */
}

int main( int argc, char **argv )
{

while( !finished ) {
doSomething();
glfwSwapBuffers();
}

}

Now, events are processed during glfwSwapBuffers() call in the main loop. While resizing the program’s window I can see that windowResize( int w, int h ) is being called several times until I release the mouse button. However window’s content doesn’t get redraw. It’s updated (by glClear()) after I stop to resize the window. Things are yet different if I uncomment line marked “1”: now window’s content gets updated instantly, I don’t need to release the button. How come?

nobody wrote on Sunday, September 18, 2005:

I would have to see more of the code to give you an exact answer but what I think is happening (going on the info that you gave) is that the glfwSwapBuffers is instantly fliping the buffers. I do a similar thing in my code if the window is resized using glfwSetWindowRefreshCallback. Also try taking out the swapbuffers and the glClear and then see what happens.