Added FREEGLUT_VERSION_1_3.

Added GLUT_VERSION for glutGet().
Added glutGet() documentation.


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@77 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
brianp 2003-06-18 21:15:22 +00:00
parent df5158ee43
commit c78b990565
5 changed files with 135 additions and 7 deletions

View File

@ -807,6 +807,67 @@ have them fixed.
<h2> <h2>
13.2&nbsp; glutGet</h2> 13.2&nbsp; glutGet</h2>
<p>
The following state variables may be queried with glutGet.
The returned value is an integer.
</p>
<p>
These queries are with respect to the current window:
</p>
<ul>
<li>GLUT_WINDOW_X - window X position
<li>GLUT_WINDOW_Y - window Y position
<li>GLUT_WINDOW_WIDTH - window width
<li>GLUT_WINDOW_HEIGHT - window height
<li>GLUT_WINDOW_BUFFER_SIZE - number of color or color index bits per pixel
<li>GLUT_WINDOW_STENCIL_SIZE - number of bits per stencil value
<li>GLUT_WINDOW_DEPTH_SIZE - number of bits per depth value
<li>GLUT_WINDOW_RED_SIZE - number of bits per red value
<li>GLUT_WINDOW_GREEN_SIZE - number of bits per green value
<li>GLUT_WINDOW_BLUE_SIZE - number of bits per blue value
<li>GLUT_WINDOW_ALPHA_SIZE - number of bits per alpha value
<li>GLUT_WINDOW_ACCUM_RED_SIZE - number of red bits in the accumulation buffer
<li>GLUT_WINDOW_ACCUM_GREEN_SIZE - number of green bits in the accumulation buffer
<li>GLUT_WINDOW_ACCUM_BLUE_SIZE - number of blue bits in the accumulation buffer
<li>GLUT_WINDOW_ACCUM_ALPHA_SIZE - number of alpha bits in the accumulation buffer
<li>GLUT_WINDOW_DOUBLEBUFFER - 1 if the color buffer is double buffered, 0 otherwise
<li>GLUT_WINDOW_RGBA - 1 if the color buffers are RGB[A], 0 for color index
<li>GLUT_WINDOW_PARENT - parent window ID
<li>GLUT_WINDOW_NUM_CHILDREN - number of child windows
<li>GLUT_WINDOW_COLORMAP_SIZE - number of entries in the window's colormap
<li>GLUT_WINDOW_NUM_SAMPLES - number of samples per pixel if using multisampling
<li>GLUT_WINDOW_STEREO - 1 if the window supports stereo, 0 otherwise
<li>GLUT_WINDOW_CURSOR - current cursor
<li>GLUT_WINDOW_FORMAT_ID - on Windows, return the pixel format number of the current window
</ul>
<p>
These queries do not depend on the current window.
</p>
<ul>
<li>GLUT_SCREEN_WIDTH - width of the screen in pixels
<li>GLUT_SCREEN_HEIGHT - height of the screen in pixels
<li>GLUT_SCREEN_WIDTH_MM - width of the screen in millimeters
<li>GLUT_SCREEN_HEIGHT_MM - height of the screen in millimeters
<li>GLUT_MENU_NUM_ITEMS - number of items in the current menu
<li>GLUT_DISPLAY_MODE_POSSIBLE - return 1 if the current display mode is supported, 0 otherwise
<li>GLUT_INIT_WINDOW_X - X position last set by glutInitWindowPosition
<li>GLUT_INIT_WINDOW_Y - Y position last set by glutInitWindowPosition
<li>GLUT_INIT_WINDOW_WIDTH - width last set by glutInitWindowSize
<li>GLUT_INIT_WINDOW_HEIGHT - height last set by glutInitWindowSize
<li>GLUT_INIT_DISPLAY_MODE - display mode last set by glutInitDisplayMode
<li>GLUT_ELAPSED_TIME - time (in milliseconds) elapsed since glutInit or glutGet(GLUT_ELAPSED_TIME) was first called
<li>GLUT_INIT_STATE - ?
<li>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).
</ul>
<h2> <h2>
13.3&nbsp; glutDeviceGet</h2> 13.3&nbsp; glutDeviceGet</h2>
@ -839,6 +900,8 @@ interoperate better with various implementations of OpenGL.
</p> </p>
<p> <p>
Both OpenGL functions and FreeGLUT functions can be queried with this function. 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.
</p> </p>
<p> <p>
<b>NOTE</b>: this function is not supported in GLUT. <b>NOTE</b>: this function is not supported in GLUT.
@ -1365,6 +1428,52 @@ interval.
<h1> <h1>
23.0&nbsp;<a NAME="Freeglut.h_Header"></a> "freeglut.h" Header File</h1> 23.0&nbsp;<a NAME="Freeglut.h_Header"></a> "freeglut.h" Header File</h1>
<p>
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:
</p>
<pre>
#include &lt;GL/glut.h&gt;
#ifdef FREEGLUT
#include &lt;GL/freeglut_ext.h&gt;
#endif
</pre>
<p>
Compile-time FreeGLUT version testing can be done as follows:
</p>
<pre>
#ifdef FREEGLUT_VERSION_1_3
code specific to FreeGLUT 1.3 or later here
#endif
</pre>
<p>
In future releases, FREEGLUT_VERSION_1_4, FREEGLUT_VERSION_1_5, etc will
be defined. This scheme mimics OpenGL conventions.
</p>
<p>
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.
</p>
<p>
This may be used as follows:
</p>
<pre>
if (glutGet(GLUT_VERSION) < 10300) {
printf("Sorry, you need FreeGLUT version 1.3.0 or later to run this program.\n");
exit(1);
}
</pre>
<h1> <h1>
24.0&nbsp;<a NAME="References"></a> References</h1> 24.0&nbsp;<a NAME="References"></a> References</h1>

View File

@ -28,6 +28,13 @@
#ifndef FREEGLUT_INTERNAL_H #ifndef FREEGLUT_INTERNAL_H
#define FREEGLUT_INTERNAL_H #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. * Freeglut is meant to be available under all Unix/X11 and Win32 platforms.
*/ */

View File

@ -122,11 +122,11 @@ void FGAPIENTRY glutSetOption( GLenum eWhat, int value )
*/ */
int FGAPIENTRY glutGet( GLenum eWhat ) int FGAPIENTRY glutGet( GLenum eWhat )
{ {
int returnValue ; int returnValue ;
GLboolean boolValue ; GLboolean boolValue ;
if ( eWhat == GLUT_INIT_STATE ) if ( eWhat == GLUT_INIT_STATE )
return ( fgState.Time.Set ) ; return ( fgState.Time.Set ) ;
freeglut_assert_ready; freeglut_assert_ready;
@ -450,7 +450,11 @@ int FGAPIENTRY glutGet( GLenum eWhat )
return( fgListLength( &fgStructure.Menu->Entries ) ); 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: default:
/* /*

View File

@ -47,6 +47,12 @@
#define GLUT_WINDOW_BORDER_WIDTH 0x01FA #define GLUT_WINDOW_BORDER_WIDTH 0x01FA
#define GLUT_WINDOW_HEADER_HEIGHT 0x01FB #define GLUT_WINDOW_HEADER_HEIGHT 0x01FB
/*
* Runtime version checking with glutGet
*/
#define GLUT_VERSION 0x01FC
/* /*
* Process loop function, see freeglut_main.c * Process loop function, see freeglut_main.c
*/ */

View File

@ -71,8 +71,10 @@
/* /*
* The freeglut and GLUT API versions * The freeglut and GLUT API versions
*/ */
#define FREEGLUT 1 #define FREEGLUT 1
#define GLUT_API_VERSION 4 #define GLUT_API_VERSION 4
#define FREEGLUT_VERSION_1_3 1
/* /*
* Always include OpenGL and GLU headers * Always include OpenGL and GLU headers