diff --git a/freeglut/freeglut/src/freeglut_internal.h b/freeglut/freeglut/src/freeglut_internal.h index 9cfe936..45dd726 100644 --- a/freeglut/freeglut/src/freeglut_internal.h +++ b/freeglut/freeglut/src/freeglut_internal.h @@ -697,6 +697,7 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, /* * Window creation, opening, closing and destruction. + * Also CallBack initialization. * Defined in freeglut_structure.c, freeglut_window.c. */ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, @@ -710,6 +711,7 @@ void fgAddToWindowDestroyList ( SFG_Window* window, GLboolean needToClose ) ; void fgCloseWindows (); void fgDestroyWindow( SFG_Window* window, GLboolean needToClose ); +void fgInitCallBacks( SFG_Window *window ); /* * Menu creation and destruction. Defined in freeglut_structure.c diff --git a/freeglut/freeglut/src/freeglut_structure.c b/freeglut/freeglut/src/freeglut_structure.c index 8708d2b..30a905b 100644 --- a/freeglut/freeglut/src/freeglut_structure.c +++ b/freeglut/freeglut/src/freeglut_structure.c @@ -52,6 +52,13 @@ SFG_Structure fgStructure = { { NULL, NULL }, /* The list of windows */ /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */ +void fgInitCallBacks( SFG_Window *window ) +{ + int i; + for( i = 0; i < TOTAL_CALLBACKS; ++i ) + window->CallBacks[ i ] = NULL; +} + /* * This private function creates, opens and adds to the hierarchy * a freeglut window complete with OpenGL context and stuff... @@ -67,6 +74,8 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, SFG_Window *window = (SFG_Window *)calloc( sizeof(SFG_Window), 1 ); int fakeArgc = 0; + fgInitCallBacks( window ); + /* * If the freeglut internals haven't been initialized yet, * do it now. Hack's idea courtesy of Chris Purnell...