Gizmo3D

gzBasicTypes.h

Go to the documentation of this file.
00001 //*****************************************************************************
00002 // File         : gzBasictypes.h
00003 // Module       : gzBase
00004 // Description  : Class definition of basic types
00005 // Author       : Anders Modén      
00006 // Product      : GizmoBase 2.1.1
00007 //      
00008 // Copyright © 2003- Saab Training Systems AB, Sweden
00009 //          
00010 // NOTE:    GizmoBase is a platform abstraction utility layer for C++. It contains 
00011 //          design patterns and C++ solutions for the advanced programmer.
00012 //
00013 //
00014 // Revision History...                          
00015 //                                  
00016 // Who  Date    Description                     
00017 //                                  
00018 // AMO  980819  Created file    
00019 //
00020 //******************************************************************************
00021 
00022 #ifndef __GZ_BASIC_TYPES_H__
00023 #define __GZ_BASIC_TYPES_H__
00024 
00039 #include "memory.h"
00040 #include "limits.h"
00041 #include "float.h"
00042 
00043 // ------------------------- Detect Win32 environment ----------------------------------------------
00044 
00045 #if defined WIN32 && !(defined GZ_WIN32 || defined GZ_WINCE || defined GZ_PPC_2002)
00046     #define GZ_WIN32
00047 #endif
00048 
00049 
00050 // ------------------ Check to see that a valid platform is defined ---------------------------------
00051 
00052 #if !defined GZ_WIN32 && !defined GZ_MAC && !defined GZ_LINUX && !defined GZ_SGI && !defined GZ_WINCE
00053 #error "You need to define your platform (GZ_WIN32,GZ_MAC,GZ_LINUX,GZ_SGI,GZ_WINCE)"
00054 #endif
00055 
00056 
00057 // --------------------------- Platform settings ----------------------------------------------------
00058 
00059 #if defined GZ_WIN32  // ---------------- WinNT , 2000, XP  ---------------
00060 
00061     // Disable warning about proper C++
00062     #pragma warning( disable : 4290 )
00063     #pragma warning( disable : 4786 )
00064     #if _MSC_VER > 1200
00065         #pragma warning(disable : 4244) 
00066         #pragma warning(disable : 4996) 
00067     #endif
00068 
00069 
00070 
00071     // Definitions of WINNT as minimal level
00072     #if !defined _WIN32_WINNT | _WIN32_WINNT<0x0500
00073         #undef _WIN32_WINNT
00074         #define _WIN32_WINNT 0x0500
00075     #endif
00076 
00077     #define GZ_LIB_EXT_SEP_D    "_d"
00078     #define GZ_LIB_EXT_SEP_DP   "_dp"
00079     #define GZ_LIB_PREFIX       
00080 
00081     #define GZ_ADVANCED_MEM
00082     #define GZ_NO_EXCEPTIONS 0  // Use c++ exceptions
00083     #include <windows.h>
00084 
00085     #define LL(x) x
00086     #define GZ_CALLBACK     __stdcall
00087     #define GZ_CALLBACK_C   __cdecl
00088     #define GZ_64_BITS
00089 
00090     #ifndef GZ_PLATFORM
00091         #define GZ_PLATFORM "win32"
00092     #endif
00093 
00094     #define GZ_WINDOWS  // Common for all WINDOWS based platforms
00095 
00096 #endif
00097 
00098 #if defined GZ_PPC_2002         // ---------------- PPC 2002 ---------------
00099     #define GZ_NO_EXCEPTIONS 1  // Dont' use c++ exceptions
00100     #include <windows.h>
00101     #define LL(x) x
00102 
00103     #define GZ_LIB_EXT_SEP_D    "_d"
00104     #define GZ_LIB_EXT_SEP_DP   "_dp"
00105     #define GZ_LIB_PREFIX       
00106 
00107     #define GZ_CALLBACK  __stdcall
00108     #define GZ_CALLBACK_C   __cdecl
00109 
00110     #ifndef GZ_PLATFORM
00111         #define GZ_PLATFORM "ppc2002"
00112     #endif
00113 
00114     #define GZ_WINDOWS  // Common for all WINDOWS based platforms
00115 
00116 #endif
00117 
00118 #ifdef GZ_WINCE
00119 
00120 /*
00121     // Disable warning about proper C++
00122     #pragma warning( disable : 4290 )
00123     #pragma warning( disable : 4786 )
00124 */
00125     // Definitions of WINNT as minimal level
00126     #if !defined _WIN32_WINNT | _WIN32_WINNT<0x0400
00127         #define _WIN32_WINNT 0x0400
00128     #endif
00129 
00130     #define GZ_LIB_EXT_SEP_D    "_d"
00131     #define GZ_LIB_EXT_SEP_DP   "_dp"
00132     #define GZ_LIB_PREFIX       
00133 
00134     #define GZ_ADVANCED_MEM
00135     #define GZ_NO_EXCEPTIONS 0  // Use c++ exceptions
00136     #include <windows.h>
00137 
00138     #define LL(x) x
00139     #define GZ_CALLBACK     __stdcall
00140     #define GZ_CALLBACK_C   __cdecl
00141     //#define GZ_64_BITS
00142 
00143     #ifndef GZ_PLATFORM
00144         #define GZ_PLATFORM "wince"
00145     #endif
00146 
00147     #define GZ_WINDOWS  // Common for all WINDOWS based platforms
00148 
00149 #endif
00150 
00151 #ifdef GZ_SGI // --------------------- Irix 6.5 GCC ----------------
00152 
00153     #define GZ_ADVANCED_MEM     // GCC
00154     #define LL(x) (x ## ll)
00155 
00156     #define GZ_GLX          // GLX X11
00157     #define GZ_LIB_EXT_SEP_D    "-g"
00158     #define GZ_LIB_EXT_SEP_DP   "-dp"
00159     #define GZ_LIB_PREFIX       "lib"
00160     #define GZ_UNIX         // Unix or posix like API
00161     #define GZ_CALLBACK
00162     #define GZ_CALLBACK_C   
00163     #define GZ_NO_EXCEPTIONS 0  // Use c++ exceptions
00164     #include <ctype.h>
00165 
00166     #ifndef GZ_PLATFORM
00167         #define GZ_PLATFORM "irix"
00168     #endif
00169 
00170 #endif
00171 
00172 #if defined GZ_LINUX // --------------- Linux on I686 HW -----------------
00173 
00174     #define GZ_ADVANCED_MEM
00175     #define LL(x) (x ## ll)
00176     #define GZ_GLX          // GLX X11
00177     #define GZ_LIB_EXT_SEP_D    "-g"
00178     #define GZ_LIB_EXT_SEP_DP   "-dp"
00179     #define GZ_LIB_PREFIX       "lib"
00180     #define GZ_UNIX         // Unix or posix like API
00181     #define GZ_NO_EXCEPTIONS 0  // Use c++ exceptions
00182     #define GZ_CALLBACK
00183     #define GZ_CALLBACK_C
00184     #include <ctype.h>
00185 
00186     #ifndef GZ_PLATFORM
00187         #define GZ_PLATFORM "linux686"
00188     #endif
00189 
00190 #endif
00191 
00192 #ifdef GZ_MAC // ---------------------- MacOSX ---------------------------
00193     
00194     #include <Carbon/Carbon.h>
00195     #define GZ_ADVANCED_MEM
00196     #define LL(x) (x ## ll)
00197     #define GZ_UNIX         // Unix or posix like API
00198     #define GZ_LIB_EXT_SEP_D    "-g"
00199     #define GZ_LIB_EXT_SEP_DP   "-dp"
00200     #define GZ_LIB_PREFIX       "lib"
00201 
00202     #define GZ_CALLBACK
00203     #define GZ_CALLBACK_C
00204     #define GZ_NO_EXCEPTIONS 0  // Use c++ exceptions
00205 
00206     #ifndef GZ_PLATFORM
00207         #define GZ_PLATFORM "osx"
00208     #endif
00209     
00210     #define GZ_64_BITS
00211 
00212 #endif
00213 
00214 
00215 #if GZ_NO_EXCEPTIONS
00216     #define GZ_EXCEPTION(x) 
00217     #define GZ_EXCEPTION_ELSE(x) x
00218     #define GZ_NO_THROW 
00219     #define GZ_THROW(x) 
00220 #else
00221     #define GZ_EXCEPTION(x) x
00222     #define GZ_EXCEPTION_ELSE(x) 
00223     #define GZ_NO_THROW throw()
00224     #define GZ_THROW(x) throw(x)
00225 #endif
00226 
00227 //**************** some general includes and definitions ********************
00228 
00229 #include <stdlib.h>
00230 #include <math.h>
00231 #include <string.h>
00232 
00233 #ifndef NULL
00234 #define NULL 0
00235 #endif
00236 
00237 #ifndef TRUE
00238 #define TRUE 1
00239 #endif
00240 
00241 #ifndef FALSE
00242 #define FALSE 0
00243 #endif
00244 
00246 template <class T> inline const T & gzMax(const T& x , const T& y) { return x>y ? x : y; }
00247 
00249 template <class T> inline const T & gzMin(const T& x , const T& y) { return x<y ? x : y; }
00250 
00251 template <class T> inline const T & gzClamp(const T& x , const T &min=(T)-1 , const T &max=(T)1 ) { return x<max ? x>min ? x : min : max; }
00252 
00253 template <class T> inline void gzSwap(T& a , T& b ) { T temp=a;a=b;b=temp;}
00254 
00255 template <class T> inline const T gzSign(const T& x ) { return x>=0 ? (T)1 : (T)-1; }
00256 
00257 //******************* basic types for gizmo ************************************
00258 
00259 
00260 typedef unsigned char   gzBool;         
00261 typedef unsigned int    gzBitfield;     
00262 typedef signed char     gzByte;         
00263 typedef char            gzChar;         
00264 typedef unsigned char   gzUByte;        
00265 typedef short           gzShort;        
00266 typedef unsigned short  gzUShort;       
00267 typedef int             gzInt;          
00268 typedef unsigned int    gzUInt;         
00269 typedef long            gzLong;         
00270 typedef unsigned long   gzULong;        
00271 typedef float           gzFloat;        
00272 typedef double          gzDouble;       
00273 typedef unsigned long   gzHandle;       
00274 
00275 #if !defined GZ_USE_SHORT_WCHAR 
00276 typedef wchar_t         gzWideChar;     
00277 #else
00278 typedef unsigned short  gzWideChar;     
00279 #endif
00280 
00281 
00282 #if defined GZ_MAC | defined GZ_LINUX | defined GZ_IRIX         // Check to see that wchar_t is compatible with Windows
00283 #include "wchar.h"
00284 #if (WCHAR_MAX!=0xFFFF) & !defined GZ_USE_SHORT_WCHAR   // two bytes unsigned short
00285     // To ensure the same compatibility with wide strings on all platforms
00286     //#error    You need to compile GizmoSDK with -fshort-wchar or define GZ_USE_SHORT_WCHAR
00287 #endif
00288 #endif
00289 
00290 #ifdef  GZ_WINDOWS
00291 typedef __int64             gzLongLong;
00292 typedef unsigned __int64    gzULongLong;
00293 #else
00294 typedef long long           gzLongLong;     
00295 typedef unsigned long long  gzULongLong;    
00296 #endif
00297 
00298 typedef void            gzVoid;             
00299 typedef void *          gzMemPointer;       
00300 
00301 // Temprary fix to save 64 bits error
00302 #define gzLargeValCast(x)   ((gzULong)x)    
00303 
00304 #if defined GZ_64_BITS  // 64 bit pointers
00305 
00306 inline gzULongLong gzPtr2Val(const gzVoid * const x)    { return (gzULongLong)x; }
00307 inline gzVoid * gzVal2Ptr(gzULongLong x)                { return (gzVoid *)x; }
00308 
00309 typedef gzULongLong     gzMemSize;      
00310 typedef gzLongLong      gzMemOffset;    
00311 
00312 #else                   // 32 bit pointers
00313 
00314 inline gzULong gzPtr2Val(const gzVoid * const x)        { return (gzULong)x; }
00315 inline gzVoid * gzVal2Ptr(gzULong x)                    { return (gzVoid *)x; }
00316 
00317 typedef gzULong         gzMemSize;      
00318 typedef gzLong          gzMemOffset;    
00319 
00320 #endif
00321 
00323 #define GZ_BOOL(x)  ((x) ? TRUE : FALSE)
00324 
00325 //************************ double or single precision compile ******************
00326 
00335 //#define GZ_DOUBLE_PRECISION       // Enable if we want double precision for REAL types
00336                                     // You must use the proper libs named gzxxxx_dp.
00337 
00338 #ifdef GZ_DOUBLE_PRECISION          // Double precision
00339 
00340     #define GZ_REAL GZ_DOUBLE
00341     typedef gzDouble gzReal;
00342     
00343     #ifdef GZ_DEBUG
00344         #define GZ_LIB_EXT GZ_LIB_EXT_SEP_D GZ_LIB_EXT_SEP_DP
00345     #else
00346         #define GZ_LIB_EXT GZ_LIB_EXT_SEP_DP
00347     #endif
00348 
00349     #define GZ_REAL_MAX DBL_MAX
00350 
00351 #else                               // Single precision for all graph calls
00352 
00353     #define GZ_REAL GZ_FLOAT 
00354     typedef gzFloat gzReal;
00355 
00356     #ifdef GZ_DEBUG
00357         #define GZ_LIB_EXT GZ_LIB_EXT_SEP_D
00358     #else
00359         #define GZ_LIB_EXT ""
00360     #endif
00361 
00362     #define GZ_REAL_MAX FLT_MAX
00363 
00364 #endif
00365 
00366 //************************** math constants ************************************
00367 
00369 const gzDouble      GZ_PI=3.14159265358979323846264338;
00370 const gzDouble      GZ_2PI=GZ_PI*2;
00371 const gzDouble      GZ_PI_HALF=GZ_PI/2;
00372 const gzDouble      GZ_PI_QUARTER=GZ_PI/4;
00373 
00374 const gzDouble      GZ_INV_PI=1.0/GZ_PI;
00375 const gzDouble      GZ_INV_2PI=1.0/GZ_2PI;
00376 const gzDouble      GZ_INV_PI_HALF=1.0/GZ_PI_HALF;
00377 const gzDouble      GZ_INV_PI_QUARTER=1.0/GZ_PI_QUARTER;
00378 
00379 const gzFloat       GZ_INV_255=1.0f/255.0f;
00380 
00381 const gzFloat       GZ_FLOAT_ONE=1.0f;
00382 const gzFloat       GZ_FLOAT_ZERO=0.0f;
00383 
00384 const gzDouble      GZ_DOUBLE_ONE=1.0;
00385 const gzDouble      GZ_DOUBLE_ZERO=0.0;
00386 
00387 const gzReal        GZ_REAL_ONE=1.0f;
00388 const gzReal        GZ_REAL_ZERO=0.0f;
00389 
00390 const gzDouble      GZ_DEG2RAD=0.017453292519943295769236907666667;
00391 const gzDouble      GZ_MILS2RAD=9.8174770424681038701957605625011e-4;
00392 const gzDouble      GZ_RAD2DEG=57.295779513082320876798154873916;
00393 const gzDouble      GZ_RAD2MILS=1018.5916357881301489208560866473;
00394 
00395 //************************* clamping class utilites ******************************
00396 
00398 class gzClampd
00399 {
00400 public:
00401     gzClampd(const gzDouble &d=0) {m_val=gzMax(gzMin(d,GZ_DOUBLE_ONE),GZ_DOUBLE_ZERO);}
00402 
00403     const gzClampd & operator=(const gzDouble &right)
00404     {
00405         m_val=gzMax(gzMin(right,GZ_DOUBLE_ONE),GZ_DOUBLE_ZERO);
00406 
00407         return *this;
00408     }
00409 
00410     operator const gzDouble &() const { return m_val; }
00411 
00412 private:
00413     gzDouble m_val;
00414 };
00415 
00417 class gzClampf
00418 {
00419 public:
00420     gzClampf(const gzFloat &d=0) {m_val=gzMax(gzMin(d,GZ_FLOAT_ONE),GZ_FLOAT_ZERO);}
00421 
00422     const gzClampf & operator=(const gzFloat &right)
00423     {
00424         m_val=gzMax(gzMin(right,GZ_FLOAT_ONE),GZ_FLOAT_ZERO);
00425 
00426         return *this;
00427     }
00428 
00429     operator const gzFloat &() const { return m_val; }
00430 
00431 private:
00432     gzFloat m_val;
00433 };
00434 
00436 class gzClampr
00437 {
00438 public:
00439     gzClampr(const gzReal &d=0) {m_val=gzMax(gzMin(d,GZ_REAL_ONE),GZ_REAL_ZERO);}
00440 
00441     const gzClampr & operator=(const gzReal &right)
00442     {
00443         m_val=gzMax(gzMin(right,GZ_REAL_ONE),GZ_REAL_ZERO);
00444 
00445         return *this;
00446     }
00447 
00448     operator const gzReal &() const { return m_val; }
00449 
00450 private:
00451     gzReal m_val;
00452 };
00453 
00454 //******************************* constants ****************************************
00455 
00456 // Some constants to avoid conflicts with OpenGL
00457 
00463 typedef enum {
00464     /* Boolean values */
00465     GZ_FALSE            = 0,
00466     GZ_TRUE             = 1,
00467 
00468     /* Data types */
00469     GZ_BYTE             = 0x1400,
00470     GZ_UNSIGNED_BYTE    = 0x1401,
00471     GZ_SHORT            = 0x1402,
00472     GZ_UNSIGNED_SHORT   = 0x1403,
00473     GZ_INT              = 0x1404,
00474     GZ_UNSIGNED_INT     = 0x1405,
00475     GZ_FLOAT            = 0x1406,
00476     GZ_DOUBLE           = 0x140A,
00477     GZ_2_BYTES          = 0x1407,
00478     GZ_3_BYTES          = 0x1408,
00479     GZ_4_BYTES          = 0x1409,
00480 
00481     /* Primitives */
00482     GZ_LINES                = 0x0001,
00483     GZ_POINTS               = 0x0000,
00484     GZ_LINE_STRIP           = 0x0003,
00485     GZ_LINE_LOOP            = 0x0002,
00486     GZ_TRIANGLES            = 0x0004,
00487     GZ_TRIANGLE_STRIP       = 0x0005,
00488     GZ_TRIANGLE_FAN         = 0x0006,
00489     GZ_QUADS                = 0x0007,
00490     GZ_QUAD_STRIP           = 0x0008,
00491     GZ_POLYGON              = 0x0009,
00492     GZ_EDGE_FLAG            = 0x0B43,
00493 
00494     /* Vertex Arrays */
00495     GZ_VERTEX_ARRAY         = 0x8074,
00496     GZ_NORMAL_ARRAY         = 0x8075,
00497     GZ_COLOR_ARRAY          = 0x8076,
00498     GZ_INDEX_ARRAY          = 0x8077,
00499     GZ_TEXTURE_COORD_ARRAY  = 0x8078,
00500     GZ_EDGE_FLAG_ARRAY      = 0x8079,
00501     GZ_VERTEX_ARRAY_SIZE    = 0x807A,
00502     GZ_VERTEX_ARRAY_TYPE    = 0x807B,
00503     GZ_VERTEX_ARRAY_STRIDE  = 0x807C,
00504     GZ_NORMAL_ARRAY_TYPE    = 0x807E,
00505     GZ_NORMAL_ARRAY_STRIDE  = 0x807F,
00506     GZ_COLOR_ARRAY_SIZE     = 0x8081,
00507     GZ_COLOR_ARRAY_TYPE     = 0x8082,
00508     GZ_COLOR_ARRAY_STRIDE   = 0x8083,
00509     GZ_INDEX_ARRAY_TYPE     = 0x8085,
00510     GZ_INDEX_ARRAY_STRIDE   = 0x8086,
00511     GZ_TEXTURE_COORD_ARRAY_SIZE = 0x8088,
00512     GZ_TEXTURE_COORD_ARRAY_TYPE = 0x8089,
00513     GZ_TEXTURE_COORD_ARRAY_STRIDE   = 0x808A,
00514     GZ_EDGE_FLAG_ARRAY_STRIDE   = 0x808C,
00515     GZ_VERTEX_ARRAY_POINTER     = 0x808E,
00516     GZ_NORMAL_ARRAY_POINTER     = 0x808F,
00517     GZ_COLOR_ARRAY_POINTER      = 0x8090,
00518     GZ_INDEX_ARRAY_POINTER      = 0x8091,
00519     GZ_TEXTURE_COORD_ARRAY_POINTER  = 0x8092,
00520     GZ_EDGE_FLAG_ARRAY_POINTER  = 0x8093,
00521 
00522     GZ_V2F              = 0x2A20,
00523     GZ_V3F              = 0x2A21,
00524     GZ_C4UB_V2F         = 0x2A22,
00525     GZ_C4UB_V3F         = 0x2A23,
00526     GZ_C3F_V3F          = 0x2A24,
00527     GZ_N3F_V3F          = 0x2A25,
00528     GZ_C4F_N3F_V3F          = 0x2A26,
00529     GZ_T2F_V3F          = 0x2A27,
00530     GZ_T4F_V4F          = 0x2A28,
00531     GZ_T2F_C4UB_V3F         = 0x2A29,
00532     GZ_T2F_C3F_V3F          = 0x2A2A,
00533     GZ_T2F_N3F_V3F          = 0x2A2B,
00534     GZ_T2F_C4F_N3F_V3F      = 0x2A2C,
00535     GZ_T4F_C4F_N3F_V4F      = 0x2A2D,
00536 
00537     /* Matrix Mode */
00538     GZ_MATRIX_MODE          = 0x0BA0,
00539     GZ_MODELVIEW            = 0x1700,
00540     GZ_PROJECTION           = 0x1701,
00541     GZ_TEXTURE              = 0x1702,
00542 
00543     /* Points */
00544     GZ_POINT_SMOOTH         = 0x0B10,
00545     GZ_POINT_SIZE           = 0x0B11,
00546     GZ_POINT_SIZE_GRANULARITY   = 0x0B13,
00547     GZ_POINT_SIZE_RANGE     = 0x0B12,
00548 
00549     /* Lines */
00550     GZ_LINE_SMOOTH          = 0x0B20,
00551     GZ_LINE_STIPPLE         = 0x0B24,
00552     GZ_LINE_STIPPLE_PATTERN     = 0x0B25,
00553     GZ_LINE_STIPPLE_REPEAT      = 0x0B26,
00554     GZ_LINE_WIDTH           = 0x0B21,
00555     GZ_LINE_WIDTH_GRANULARITY   = 0x0B23,
00556     GZ_LINE_WIDTH_RANGE     = 0x0B22,
00557 
00558     /* Polygons */
00559     GZ_POINT            = 0x1B00,
00560     GZ_LINE             = 0x1B01,
00561     GZ_FILL             = 0x1B02,
00562     GZ_CCW              = 0x0901,
00563     GZ_CW               = 0x0900,
00564     GZ_FRONT            = 0x0404,
00565     GZ_BACK             = 0x0405,
00566     GZ_CULL_FACE            = 0x0B44,
00567     GZ_CULL_FACE_MODE       = 0x0B45,
00568     GZ_POLYGON_SMOOTH       = 0x0B41,
00569     GZ_POLYGON_STIPPLE      = 0x0B42,
00570     GZ_FRONT_FACE           = 0x0B46,
00571     GZ_POLYGON_MODE         = 0x0B40,
00572     GZ_POLYGON_OFFSET_FACTOR    = 0x8038,
00573     GZ_POLYGON_OFFSET_UNITS     = 0x2A00,
00574     GZ_POLYGON_OFFSET_POINT     = 0x2A01,
00575     GZ_POLYGON_OFFSET_LINE      = 0x2A02,
00576     GZ_POLYGON_OFFSET_FILL      = 0x8037,
00577 
00578     /* Display Lists */
00579     GZ_COMPILE          = 0x1300,
00580     GZ_COMPILE_AND_EXECUTE      = 0x1301,
00581     GZ_LIST_BASE            = 0x0B32,
00582     GZ_LIST_INDEX           = 0x0B33,
00583     GZ_LIST_MODE            = 0x0B30,
00584 
00585     /* Depth buffer */
00586     GZ_NEVER            = 0x0200,
00587     GZ_LESS             = 0x0201,
00588     GZ_GEQUAL           = 0x0206,
00589     GZ_LEQUAL           = 0x0203,
00590     GZ_GREATER          = 0x0204,
00591     GZ_NOTEQUAL         = 0x0205,
00592     GZ_EQUAL            = 0x0202,
00593     GZ_ALWAYS           = 0x0207,
00594     GZ_DEPTH_TEST           = 0x0B71,
00595     GZ_DEPTH_BITS           = 0x0D56,
00596     GZ_DEPTH_CLEAR_VALUE        = 0x0B73,
00597     GZ_DEPTH_FUNC           = 0x0B74,
00598     GZ_DEPTH_RANGE          = 0x0B70,
00599     GZ_DEPTH_WRITEMASK      = 0x0B72,
00600     GZ_DEPTH_COMPONENT      = 0x1902,
00601 
00602     /* Lighting */
00603     GZ_LIGHTING         = 0x0B50,
00604     GZ_LIGHT0           = 0x4000,
00605     GZ_LIGHT1           = 0x4001,
00606     GZ_LIGHT2           = 0x4002,
00607     GZ_LIGHT3           = 0x4003,
00608     GZ_LIGHT4           = 0x4004,
00609     GZ_LIGHT5           = 0x4005,
00610     GZ_LIGHT6           = 0x4006,
00611     GZ_LIGHT7           = 0x4007,
00612     GZ_SPOT_EXPONENT        = 0x1205,
00613     GZ_SPOT_CUTOFF          = 0x1206,
00614     GZ_CONSTANT_ATTENUATION     = 0x1207,
00615     GZ_LINEAR_ATTENUATION       = 0x1208,
00616     GZ_QUADRATIC_ATTENUATION    = 0x1209,
00617     GZ_AMBIENT          = 0x1200,
00618     GZ_DIFFUSE          = 0x1201,
00619     GZ_SPECULAR         = 0x1202,
00620     GZ_SHININESS            = 0x1601,
00621     GZ_EMISSION         = 0x1600,
00622     GZ_POSITION         = 0x1203,
00623     GZ_SPOT_DIRECTION       = 0x1204,
00624     GZ_AMBIENT_AND_DIFFUSE      = 0x1602,
00625     GZ_COLOR_INDEXES        = 0x1603,
00626     GZ_LIGHT_MODEL_TWO_SIDE     = 0x0B52,
00627     GZ_LIGHT_MODEL_LOCAL_VIEWER = 0x0B51,
00628     GZ_LIGHT_MODEL_AMBIENT      = 0x0B53,
00629     GZ_FRONT_AND_BACK       = 0x0408,
00630     GZ_SHADE_MODEL          = 0x0B54,
00631     GZ_FLAT             = 0x1D00,
00632     GZ_SMOOTH           = 0x1D01,
00633     GZ_COLOR_MATERIAL       = 0x0B57,
00634     GZ_COLOR_MATERIAL_FACE      = 0x0B55,
00635     GZ_COLOR_MATERIAL_PARAMETER = 0x0B56,
00636     GZ_NORMALIZE            = 0x0BA1,
00637 
00638     /* User clipping planes */
00639     GZ_CLIP_PLANE0          = 0x3000,
00640     GZ_CLIP_PLANE1          = 0x3001,
00641     GZ_CLIP_PLANE2          = 0x3002,
00642     GZ_CLIP_PLANE3          = 0x3003,
00643     GZ_CLIP_PLANE4          = 0x3004,
00644     GZ_CLIP_PLANE5          = 0x3005,
00645 
00646     /* Accumulation buffer */
00647     GZ_ACCUM_RED_BITS       = 0x0D58,
00648     GZ_ACCUM_GREEN_BITS     = 0x0D59,
00649     GZ_ACCUM_BLUE_BITS      = 0x0D5A,
00650     GZ_ACCUM_ALPHA_BITS     = 0x0D5B,
00651     GZ_ACCUM_CLEAR_VALUE        = 0x0B80,
00652     GZ_ACCUM            = 0x0100,
00653     GZ_ADD              = 0x0104,
00654     GZ_LOAD             = 0x0101,
00655     GZ_MULT             = 0x0103,
00656     GZ_RETURN           = 0x0102,
00657 
00658     /* Alpha testing */
00659     GZ_ALPHA_TEST           = 0x0BC0,
00660     GZ_ALPHA_TEST_REF       = 0x0BC2,
00661     GZ_ALPHA_TEST_FUNC      = 0x0BC1,
00662 
00663     /* Blending */
00664     GZ_BLEND            = 0x0BE2,
00665     GZ_BLEND_SRC            = 0x0BE1,
00666     GZ_BLEND_DST            = 0x0BE0,
00667     GZ_ZERO             = 0,
00668     GZ_ONE              = 1,
00669     GZ_SRC_COLOR            = 0x0300,
00670     GZ_ONE_MINUS_SRC_COLOR      = 0x0301,
00671     GZ_DST_COLOR            = 0x0306,
00672     GZ_ONE_MINUS_DST_COLOR      = 0x0307,
00673     GZ_SRC_ALPHA            = 0x0302,
00674     GZ_ONE_MINUS_SRC_ALPHA      = 0x0303,
00675     GZ_DST_ALPHA            = 0x0304,
00676     GZ_ONE_MINUS_DST_ALPHA      = 0x0305,
00677     GZ_SRC_ALPHA_SATURATE       = 0x0308,
00678     GZ_CONSTANT_COLOR       = 0x8001,
00679     GZ_ONE_MINUS_CONSTANT_COLOR = 0x8002,
00680     GZ_CONSTANT_ALPHA       = 0x8003,
00681     GZ_ONE_MINUS_CONSTANT_ALPHA = 0x8004,
00682 
00683     /* Render Mode */
00684     GZ_FEEDBACK         = 0x1C01,
00685     GZ_RENDER           = 0x1C00,
00686     GZ_SELECT           = 0x1C02,
00687 
00688     /* Feedback */
00689     GZ_2D               = 0x0600,
00690     GZ_3D               = 0x0601,
00691     GZ_3D_COLOR         = 0x0602,
00692     GZ_3D_COLOR_TEXTURE     = 0x0603,
00693     GZ_4D_COLOR_TEXTURE     = 0x0604,
00694     GZ_POINT_TOKEN          = 0x0701,
00695     GZ_LINE_TOKEN           = 0x0702,
00696     GZ_LINE_RESET_TOKEN     = 0x0707,
00697     GZ_POLYGON_TOKEN        = 0x0703,
00698     GZ_BITMAP_TOKEN         = 0x0704,
00699     GZ_DRAW_PIXEL_TOKEN     = 0x0705,
00700     GZ_COPY_PIXEL_TOKEN     = 0x0706,
00701     GZ_PASS_THROUGH_TOKEN       = 0x0700,
00702     GZ_FEEDBACK_BUFFER_POINTER  = 0x0DF0,
00703     GZ_FEEDBACK_BUFFER_SIZE     = 0x0DF1,
00704     GZ_FEEDBACK_BUFFER_TYPE     = 0x0DF2,
00705 
00706     /* Selection */
00707     GZ_SELECTION_BUFFER_POINTER = 0x0DF3,
00708     GZ_SELECTION_BUFFER_SIZE    = 0x0DF4,
00709 
00710     /* Fog */
00711     GZ_FOG              = 0x0B60,
00712     GZ_FOG_MODE         = 0x0B65,
00713     GZ_FOG_DENSITY          = 0x0B62,
00714     GZ_FOG_COLOR            = 0x0B66,
00715     GZ_FOG_INDEX            = 0x0B61,
00716     GZ_FOG_START            = 0x0B63,
00717     GZ_FOG_END          = 0x0B64,
00718     GZ_LINEAR           = 0x2601,
00719     GZ_EXP              = 0x0800,
00720     GZ_EXP2             = 0x0801,
00721 
00722     /* Logic Ops */
00723     GZ_LOGIC_OP         = 0x0BF1,
00724     GZ_INDEX_LOGIC_OP       = 0x0BF1,
00725     GZ_COLOR_LOGIC_OP       = 0x0BF2,
00726     GZ_LOGIC_OP_MODE        = 0x0BF0,
00727     GZ_CLEAR            = 0x1500,
00728     GZ_SET              = 0x150F,
00729     GZ_COPY             = 0x1503,
00730     GZ_COPY_INVERTED        = 0x150C,
00731     GZ_NOOP             = 0x1505,
00732     GZ_INVERT           = 0x150A,
00733     GZ_AND              = 0x1501,
00734     GZ_NAND             = 0x150E,
00735     GZ_OR               = 0x1507,
00736     GZ_NOR              = 0x1508,
00737     GZ_XOR              = 0x1506,
00738     GZ_EQUIV            = 0x1509,
00739     GZ_AND_REVERSE          = 0x1502,
00740     GZ_AND_INVERTED         = 0x1504,
00741     GZ_OR_REVERSE           = 0x150B,
00742     GZ_OR_INVERTED          = 0x150D,
00743 
00744     /* Stencil */
00745     GZ_STENCIL_TEST         = 0x0B90,
00746     GZ_STENCIL_WRITEMASK        = 0x0B98,
00747     GZ_STENCIL_BITS         = 0x0D57,
00748     GZ_STENCIL_FUNC         = 0x0B92,
00749     GZ_STENCIL_VALUE_MASK       = 0x0B93,
00750     GZ_STENCIL_REF          = 0x0B97,
00751     GZ_STENCIL_FAIL         = 0x0B94,
00752     GZ_STENCIL_PASS_DEPTH_PASS  = 0x0B96,
00753     GZ_STENCIL_PASS_DEPTH_FAIL  = 0x0B95,
00754     GZ_STENCIL_CLEAR_VALUE      = 0x0B91,
00755     GZ_STENCIL_INDEX        = 0x1901,
00756     GZ_KEEP             = 0x1E00,
00757     GZ_REPLACE          = 0x1E01,
00758     GZ_INCR             = 0x1E02,
00759     GZ_DECR             = 0x1E03,
00760 
00761     /* Buffers, Pixel Drawing/Reading */
00762     GZ_NONE             = 0,
00763     GZ_LEFT             = 0x0406,
00764     GZ_RIGHT            = 0x0407,
00765     /*GZ_FRONT          = 0x0404, */
00766     /*GZ_BACK           = 0x0405, */
00767     /*GZ_FRONT_AND_BACK     = 0x0408, */
00768     GZ_FRONT_LEFT           = 0x0400,
00769     GZ_FRONT_RIGHT          = 0x0401,
00770     GZ_BACK_LEFT            = 0x0402,
00771     GZ_BACK_RIGHT           = 0x0403,
00772     GZ_AUX0             = 0x0409,
00773     GZ_AUX1             = 0x040A,
00774     GZ_AUX2             = 0x040B,
00775     GZ_AUX3             = 0x040C,
00776     GZ_COLOR_INDEX          = 0x1900,
00777     GZ_RED              = 0x1903,
00778     GZ_GREEN            = 0x1904,
00779     GZ_BLUE             = 0x1905,
00780     GZ_ALPHA            = 0x1906,
00781     GZ_LUMINANCE            = 0x1909,
00782     GZ_LUMINANCE_ALPHA      = 0x190A,
00783     GZ_ALPHA_BITS           = 0x0D55,
00784     GZ_RED_BITS         = 0x0D52,
00785     GZ_GREEN_BITS           = 0x0D53,
00786     GZ_BLUE_BITS            = 0x0D54,
00787     GZ_INDEX_BITS           = 0x0D51,
00788     GZ_SUBPIXEL_BITS        = 0x0D50,
00789     GZ_AUX_BUFFERS          = 0x0C00,
00790     GZ_READ_BUFFER          = 0x0C02,
00791     GZ_DRAW_BUFFER          = 0x0C01,
00792     GZ_DOUBLEBUFFER         = 0x0C32,
00793     GZ_STEREO           = 0x0C33,
00794     GZ_BITMAP           = 0x1A00,
00795     GZ_COLOR            = 0x1800,
00796     GZ_DEPTH            = 0x1801,
00797     GZ_STENCIL          = 0x1802,
00798     GZ_DITHER           = 0x0BD0,
00799     GZ_RGB              = 0x1907,
00800     GZ_RGBA             = 0x1908,
00801 
00802     /* Implementation limits */
00803     GZ_MAX_LIST_NESTING     = 0x0B31,
00804     GZ_MAX_ATTRIB_STACK_DEPTH   = 0x0D35,
00805     GZ_MAX_MODELVIEW_STACK_DEPTH    = 0x0D36,
00806     GZ_MAX_NAME_STACK_DEPTH     = 0x0D37,
00807     GZ_MAX_PROJECTION_STACK_DEPTH   = 0x0D38,
00808     GZ_MAX_TEXTURE_STACK_DEPTH  = 0x0D39,
00809     GZ_MAX_EVAL_ORDER       = 0x0D30,
00810     GZ_MAX_LIGHTS           = 0x0D31,
00811     GZ_MAX_CLIP_PLANES      = 0x0D32,
00812     GZ_MAX_TEXTURE_SIZE     = 0x0D33,
00813     GZ_MAX_PIXEL_MAP_TABLE      = 0x0D34,
00814     GZ_MAX_VIEWPORT_DIMS        = 0x0D3A,
00815     GZ_MAX_CLIENT_ATTRIB_STACK_DEPTH= 0x0D3B,
00816 
00817     /* Gets */
00818     GZ_ATTRIB_STACK_DEPTH       = 0x0BB0,
00819     GZ_CLIENT_ATTRIB_STACK_DEPTH    = 0x0BB1,
00820     GZ_COLOR_CLEAR_VALUE        = 0x0C22,
00821     GZ_COLOR_WRITEMASK      = 0x0C23,
00822     GZ_CURRENT_INDEX        = 0x0B01,
00823     GZ_CURRENT_COLOR        = 0x0B00,
00824     GZ_CURRENT_NORMAL       = 0x0B02,
00825     GZ_CURRENT_RASTER_COLOR     = 0x0B04,
00826     GZ_CURRENT_RASTER_DISTANCE  = 0x0B09,
00827     GZ_CURRENT_RASTER_INDEX     = 0x0B05,
00828     GZ_CURRENT_RASTER_POSITION  = 0x0B07,
00829     GZ_CURRENT_RASTER_TEXTURE_COORDS = 0x0B06,
00830     GZ_CURRENT_RASTER_POSITION_VALID = 0x0B08,
00831     GZ_CURRENT_TEXTURE_COORDS   = 0x0B03,
00832     GZ_INDEX_CLEAR_VALUE        = 0x0C20,
00833     GZ_INDEX_MODE           = 0x0C30,
00834     GZ_INDEX_WRITEMASK      = 0x0C21,
00835     GZ_MODELVIEW_MATRIX     = 0x0BA6,
00836     GZ_MODELVIEW_STACK_DEPTH    = 0x0BA3,
00837     GZ_NAME_STACK_DEPTH     = 0x0D70,
00838     GZ_PROJECTION_MATRIX        = 0x0BA7,
00839     GZ_PROJECTION_STACK_DEPTH   = 0x0BA4,
00840     GZ_RENDER_MODE          = 0x0C40,
00841     GZ_RGBA_MODE            = 0x0C31,
00842     GZ_TEXTURE_MATRIX       = 0x0BA8,
00843     GZ_TEXTURE_STACK_DEPTH      = 0x0BA5,
00844     GZ_VIEWPORT         = 0x0BA2,
00845 
00846 
00847     /* Evaluators */
00848     GZ_AUTO_NORMAL          = 0x0D80,
00849     GZ_MAP1_COLOR_4         = 0x0D90,
00850     GZ_MAP1_GRID_DOMAIN     = 0x0DD0,
00851     GZ_MAP1_GRID_SEGMENTS       = 0x0DD1,
00852     GZ_MAP1_INDEX           = 0x0D91,
00853     GZ_MAP1_NORMAL          = 0x0D92,
00854     GZ_MAP1_TEXTURE_COORD_1     = 0x0D93,
00855     GZ_MAP1_TEXTURE_COORD_2     = 0x0D94,
00856     GZ_MAP1_TEXTURE_COORD_3     = 0x0D95,
00857     GZ_MAP1_TEXTURE_COORD_4     = 0x0D96,
00858     GZ_MAP1_VERTEX_3        = 0x0D97,
00859     GZ_MAP1_VERTEX_4        = 0x0D98,
00860     GZ_MAP2_COLOR_4         = 0x0DB0,
00861     GZ_MAP2_GRID_DOMAIN     = 0x0DD2,
00862     GZ_MAP2_GRID_SEGMENTS       = 0x0DD3,
00863     GZ_MAP2_INDEX           = 0x0DB1,
00864     GZ_MAP2_NORMAL          = 0x0DB2,
00865     GZ_MAP2_TEXTURE_COORD_1     = 0x0DB3,
00866     GZ_MAP2_TEXTURE_COORD_2     = 0x0DB4,
00867     GZ_MAP2_TEXTURE_COORD_3     = 0x0DB5,
00868     GZ_MAP2_TEXTURE_COORD_4     = 0x0DB6,
00869     GZ_MAP2_VERTEX_3        = 0x0DB7,
00870     GZ_MAP2_VERTEX_4        = 0x0DB8,
00871     GZ_COEFF            = 0x0A00,
00872     GZ_DOMAIN           = 0x0A02,
00873     GZ_ORDER            = 0x0A01,
00874 
00875     /* Hints */
00876     GZ_FOG_HINT         = 0x0C54,
00877     GZ_LINE_SMOOTH_HINT     = 0x0C52,
00878     GZ_PERSPECTIVE_CORRECTION_HINT  = 0x0C50,
00879     GZ_POINT_SMOOTH_HINT        = 0x0C51,
00880     GZ_POLYGON_SMOOTH_HINT      = 0x0C53,
00881     GZ_DONT_CARE            = 0x1100,
00882     GZ_FASTEST          = 0x1101,
00883     GZ_NICEST           = 0x1102,
00884 
00885     /* Scissor box */
00886     GZ_SCISSOR_TEST         = 0x0C11,
00887     GZ_SCISSOR_BOX          = 0x0C10,
00888 
00889     /* Pixel Mode / Transfer */
00890     GZ_MAP_COLOR            = 0x0D10,
00891     GZ_MAP_STENCIL          = 0x0D11,
00892     GZ_INDEX_SHIFT          = 0x0D12,
00893     GZ_INDEX_OFFSET         = 0x0D13,
00894     GZ_RED_SCALE            = 0x0D14,
00895     GZ_RED_BIAS         = 0x0D15,
00896     GZ_GREEN_SCALE          = 0x0D18,
00897     GZ_GREEN_BIAS           = 0x0D19,
00898     GZ_BLUE_SCALE           = 0x0D1A,
00899     GZ_BLUE_BIAS            = 0x0D1B,
00900     GZ_ALPHA_SCALE          = 0x0D1C,
00901     GZ_ALPHA_BIAS           = 0x0D1D,
00902     GZ_DEPTH_SCALE          = 0x0D1E,
00903     GZ_DEPTH_BIAS           = 0x0D1F,
00904     GZ_PIXEL_MAP_S_TO_S_SIZE    = 0x0CB1,
00905     GZ_PIXEL_MAP_I_TO_I_SIZE    = 0x0CB0,
00906     GZ_PIXEL_MAP_I_TO_R_SIZE    = 0x0CB2,
00907     GZ_PIXEL_MAP_I_TO_G_SIZE    = 0x0CB3,
00908     GZ_PIXEL_MAP_I_TO_B_SIZE    = 0x0CB4,
00909     GZ_PIXEL_MAP_I_TO_A_SIZE    = 0x0CB5,
00910     GZ_PIXEL_MAP_R_TO_R_SIZE    = 0x0CB6,
00911     GZ_PIXEL_MAP_G_TO_G_SIZE    = 0x0CB7,
00912     GZ_PIXEL_MAP_B_TO_B_SIZE    = 0x0CB8,
00913     GZ_PIXEL_MAP_A_TO_A_SIZE    = 0x0CB9,
00914     GZ_PIXEL_MAP_S_TO_S     = 0x0C71,
00915     GZ_PIXEL_MAP_I_TO_I     = 0x0C70,
00916     GZ_PIXEL_MAP_I_TO_R     = 0x0C72,
00917     GZ_PIXEL_MAP_I_TO_G     = 0x0C73,
00918     GZ_PIXEL_MAP_I_TO_B     = 0x0C74,
00919     GZ_PIXEL_MAP_I_TO_A     = 0x0C75,
00920     GZ_PIXEL_MAP_R_TO_R     = 0x0C76,
00921     GZ_PIXEL_MAP_G_TO_G     = 0x0C77,
00922     GZ_PIXEL_MAP_B_TO_B     = 0x0C78,
00923     GZ_PIXEL_MAP_A_TO_A     = 0x0C79,
00924     GZ_PACK_ALIGNMENT       = 0x0D05,
00925     GZ_PACK_LSB_FIRST       = 0x0D01,
00926