now have a default reshape callback function that is used if the user didn't set...
[freeglut] / src / fg_callbacks.c
index c83b3f0..c62d37c 100644 (file)
@@ -121,7 +121,6 @@ void FGAPIENTRY glut##a##Func( FGCB##b callback )               \
 #define IMPLEMENT_CALLBACK_FUNC(a) IMPLEMENT_CALLBACK_FUNC_2NAME(a,a)
 
 /* Implement all these callback setter functions... */
-IMPLEMENT_CALLBACK_FUNC(Reshape);
 IMPLEMENT_CALLBACK_FUNC(Position);
 IMPLEMENT_CALLBACK_FUNC(Keyboard);
 IMPLEMENT_CALLBACK_FUNC(KeyboardUp);
@@ -163,6 +162,21 @@ void FGAPIENTRY glutDisplayFunc( FGCBDisplay callback )
     SET_CALLBACK( Display );
 }
 
+void fghDefaultReshape(int width, int height)
+{
+    glViewport( 0, 0, width, height );
+}
+
+void FGAPIENTRY glutReshapeFunc( FGCBReshape callback )
+{
+    FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutReshapeFunc" );
+    
+    if( !callback )
+        callback = fghDefaultReshape;
+
+    SET_CALLBACK( Reshape );
+}
+
 /*
  * Sets the Visibility callback for the current window.
  * NB: the Visibility func is deprecated in favor of the WindowStatus func,