From 8e19a4958144b47fb4c8f9d736747df0293f19c1 Mon Sep 17 00:00:00 2001
From: Brian Paul
Date: Wed, 18 Jun 2003 21:15:22 +0000
Subject: [PATCH] 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
---
doc/freeglut_user_interface.html | 109 ++++++++++++++++++++++++++++++++++++++
freeglut-1.3/freeglut_internal.h | 7 +++
freeglut-1.3/freeglut_state.c | 14 +++--
include/GL/freeglut_ext.h | 6 +++
include/GL/glut.h | 6 ++-
5 files changed, 135 insertions(+), 7 deletions(-)
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:
+
+
+
+- GLUT_WINDOW_X - window X position
+
- GLUT_WINDOW_Y - window Y position
+
- GLUT_WINDOW_WIDTH - window width
+
- GLUT_WINDOW_HEIGHT - window height
+
- GLUT_WINDOW_BUFFER_SIZE - number of color or color index bits per pixel
+
- GLUT_WINDOW_STENCIL_SIZE - number of bits per stencil value
+
- GLUT_WINDOW_DEPTH_SIZE - number of bits per depth value
+
- GLUT_WINDOW_RED_SIZE - number of bits per red value
+
- GLUT_WINDOW_GREEN_SIZE - number of bits per green value
+
- GLUT_WINDOW_BLUE_SIZE - number of bits per blue value
+
- GLUT_WINDOW_ALPHA_SIZE - number of bits per alpha value
+
- GLUT_WINDOW_ACCUM_RED_SIZE - number of red bits in the accumulation buffer
+
- GLUT_WINDOW_ACCUM_GREEN_SIZE - number of green bits in the accumulation buffer
+
- GLUT_WINDOW_ACCUM_BLUE_SIZE - number of blue bits in the accumulation buffer
+
- GLUT_WINDOW_ACCUM_ALPHA_SIZE - number of alpha bits in the accumulation buffer
+
- GLUT_WINDOW_DOUBLEBUFFER - 1 if the color buffer is double buffered, 0 otherwise
+
- GLUT_WINDOW_RGBA - 1 if the color buffers are RGB[A], 0 for color index
+
- GLUT_WINDOW_PARENT - parent window ID
+
- GLUT_WINDOW_NUM_CHILDREN - number of child windows
+
- GLUT_WINDOW_COLORMAP_SIZE - number of entries in the window's colormap
+
- GLUT_WINDOW_NUM_SAMPLES - number of samples per pixel if using multisampling
+
- GLUT_WINDOW_STEREO - 1 if the window supports stereo, 0 otherwise
+
- GLUT_WINDOW_CURSOR - current cursor
+
- GLUT_WINDOW_FORMAT_ID - on Windows, return the pixel format number of the current window
+
+
+
+These queries do not depend on the current window.
+
+
+
+- GLUT_SCREEN_WIDTH - width of the screen in pixels
+
- GLUT_SCREEN_HEIGHT - height of the screen in pixels
+
- GLUT_SCREEN_WIDTH_MM - width of the screen in millimeters
+
- GLUT_SCREEN_HEIGHT_MM - height of the screen in millimeters
+
- GLUT_MENU_NUM_ITEMS - number of items in the current menu
+
- GLUT_DISPLAY_MODE_POSSIBLE - return 1 if the current display mode is supported, 0 otherwise
+
- GLUT_INIT_WINDOW_X - X position last set by glutInitWindowPosition
+
- GLUT_INIT_WINDOW_Y - Y position last set by glutInitWindowPosition
+
- GLUT_INIT_WINDOW_WIDTH - width last set by glutInitWindowSize
+
- GLUT_INIT_WINDOW_HEIGHT - height last set by glutInitWindowSize
+
- GLUT_INIT_DISPLAY_MODE - display mode last set by glutInitDisplayMode
+
- GLUT_ELAPSED_TIME - time (in milliseconds) elapsed since glutInit or glutGet(GLUT_ELAPSED_TIME) was first called
+
- GLUT_INIT_STATE - ?
+
- GLUT_VERSION - Return value 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 query is only supported in FreeGLUT (version 1.3 or later).
+
+
+
+
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
--
1.7.10.4