I'm using Visual Studio Express 2010, with freeglut_static.lib linked (in Properties>Linker>Input>Additional Dependencies, version 2.8.0) and FREEGLUT_STATIC defined. The code builds and compiles, though I did have to tweak a bunch of properties to get it to link. I am running Window-7 64 bit, though the code was compiled as a 32 bit executable.
The code is
// -----------------------------------
static void reshape(int w, int h) {
// free old buffers; allocate new ones; update global state
// etc...
;
}
static void display() { glutSwapBuffers(); }
int main(int argc; char **argv)
{
glutInitWindowSize(500, 500);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glutInit(argc, argv);
glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
glutDisplayFunc(display);
glutReshapeFunc(reshape);
// glutIdleFunc(display);
glutCreateWindow("Hmm");
glutMainLoop();
// free resources
return 0;
}
// ----------
The issue is that neither display() or reshape() are ever called. When the window is resized, the upper left part of it remains white and the rest becomes black.
Uncommenting the glutIdleFunc() line causes the display function to be called now, and resizing the window leaves it all black. However, reshape() is still not invoked.
I've stared at the freeglut source code and can't see what the problem is. I don't know enough about the windows API to debug freeglut, unfortunately.
Any ideas why the callbacks aren't working?