From: Brian Paul Date: Wed, 18 Jun 2003 21:15:22 +0000 (+0000) Subject: Added FREEGLUT_VERSION_1_3. X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=8e19a4958144b47fb4c8f9d736747df0293f19c1;p=freeglut Added FREEGLUT_VERSION_1_3. Added GLUT_VERSION for glutGet(). Added glutGet() documentation. git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@77 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/doc/freeglut_user_interface.html b/doc/freeglut_user_interface.html index 6dcacd5..3785559 100644 --- a/doc/freeglut_user_interface.html +++ b/doc/freeglut_user_interface.html @@ -807,6 +807,67 @@ have them fixed.

13.2  glutGet

+

+The following state variables may be queried with glutGet. +The returned value is an integer. +

+ +

+These queries are with respect to the current window: +

+ + + +

+These queries do not depend on the current window. +

+ + + + +

13.3  glutDeviceGet

@@ -839,6 +900,8 @@ interoperate better with various implementations of OpenGL.

Both OpenGL functions and FreeGLUT functions can be queried with this function. +Since WGL returns context-dependent function pointers, glutGetProcAddress +should be queried per FreeGLUT window.

NOTE: this function is not supported in GLUT. @@ -1365,6 +1428,52 @@ interval.

23.0  "freeglut.h" Header File

+

+FreeGLUT users should normally just include GL/glut.h in their programs. +Programs which need FreeGLUT-specific functions should also include +GL/freeglut_ext.h as follows: +

+ +
+#include <GL/glut.h>
+#ifdef FREEGLUT
+#include <GL/freeglut_ext.h>
+#endif
+
+ +

+Compile-time FreeGLUT version testing can be done as follows: +

+ +
+#ifdef FREEGLUT_VERSION_1_3
+  code specific to FreeGLUT 1.3 or later here
+#endif
+
+ +

+In future releases, FREEGLUT_VERSION_1_4, FREEGLUT_VERSION_1_5, etc will +be defined. This scheme mimics OpenGL conventions. +

+ +

+The FreeGLUT version can be queried at runtime by calling +glutGet(GLUT_VERSION). +The result will be X*10000+Y*100+Z where X is the major version, Y is the +minor version and Z is the patch level. +

+

+This may be used as follows: +

+ +
+if (glutGet(GLUT_VERSION) < 10300) {
+    printf("Sorry, you need FreeGLUT version 1.3.0 or later to run this program.\n");
+    exit(1);
+}
+
+ +

24.0  References

diff --git a/freeglut-1.3/freeglut_internal.h b/freeglut-1.3/freeglut_internal.h index d8d50d8..e4968e9 100644 --- a/freeglut-1.3/freeglut_internal.h +++ b/freeglut-1.3/freeglut_internal.h @@ -29,6 +29,13 @@ #define FREEGLUT_INTERNAL_H /* + * Be sure to update these for every release! + */ +#define VERSION_MAJOR 1 +#define VERSION_MINOR 3 +#define VERSION_PATCH 0 + +/* * Freeglut is meant to be available under all Unix/X11 and Win32 platforms. */ #if !defined(_WIN32) diff --git a/freeglut-1.3/freeglut_state.c b/freeglut-1.3/freeglut_state.c index 7116869..6a13db4 100644 --- a/freeglut-1.3/freeglut_state.c +++ b/freeglut-1.3/freeglut_state.c @@ -122,11 +122,11 @@ void FGAPIENTRY glutSetOption( GLenum eWhat, int value ) */ int FGAPIENTRY glutGet( GLenum eWhat ) { - int returnValue ; - GLboolean boolValue ; + int returnValue ; + GLboolean boolValue ; - if ( eWhat == GLUT_INIT_STATE ) - return ( fgState.Time.Set ) ; + if ( eWhat == GLUT_INIT_STATE ) + return ( fgState.Time.Set ) ; freeglut_assert_ready; @@ -450,7 +450,11 @@ int FGAPIENTRY glutGet( GLenum eWhat ) return( fgListLength( &fgStructure.Menu->Entries ) ); - case GLUT_ACTION_ON_WINDOW_CLOSE: return ( fgState.ActionOnWindowClose ) ; + case GLUT_ACTION_ON_WINDOW_CLOSE: + return fgState.ActionOnWindowClose; + + case GLUT_VERSION: + return VERSION_MAJOR * 10000 + VERSION_MINOR * 100 + VERSION_PATCH; default: /* diff --git a/include/GL/freeglut_ext.h b/include/GL/freeglut_ext.h index 9bef572..0f71c88 100644 --- a/include/GL/freeglut_ext.h +++ b/include/GL/freeglut_ext.h @@ -48,6 +48,12 @@ #define GLUT_WINDOW_HEADER_HEIGHT 0x01FB /* + * Runtime version checking with glutGet + */ +#define GLUT_VERSION 0x01FC + + +/* * Process loop function, see freeglut_main.c */ FGAPI void FGAPIENTRY glutMainLoopEvent( void ); diff --git a/include/GL/glut.h b/include/GL/glut.h index 5726f7c..cbc1e6c 100644 --- a/include/GL/glut.h +++ b/include/GL/glut.h @@ -71,8 +71,10 @@ /* * The freeglut and GLUT API versions */ -#define FREEGLUT 1 -#define GLUT_API_VERSION 4 +#define FREEGLUT 1 +#define GLUT_API_VERSION 4 +#define FREEGLUT_VERSION_1_3 1 + /* * Always include OpenGL and GLU headers