#ifndef COIN_GL_H
#define COIN_GL_H

/**************************************************************************\
 *
 *  This file is part of the Coin 3D visualization library.
 *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  ("GPL") version 2 as published by the Free Software Foundation.
 *  See the file LICENSE.GPL at the root directory of this source
 *  distribution for additional information about the GNU GPL.
 *
 *  For using Coin with software that can not be combined with the GNU
 *  GPL, and for taking advantage of the additional benefits of our
 *  support services, please contact Systems in Motion about acquiring
 *  a Coin Professional Edition License.
 *
 *  See <URL:http://www.coin3d.org> for  more information.
 *
 *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
 *  <URL:http://www.sim.no>.
 *
\**************************************************************************/

/* This header file is supposed to take care of all operating system
 * dependent anomalies connected to the gl.h include file. */

/* #include <windows.h> - not needed on system */
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glext.h>

/**********************************************************************/

/*
  Some systems have very old gl.h files, and other systems include
  extension enums which we want to use if we run-time detect the
  extension function calls to be available, so we just define these
  values here if not defined already.
*/

/* Note: GL_CLAMP_TO_EDGE_EXT and GL_CLAMP_TO_EDGE_SGIS have the same
   enum values as GL_CLAMP_TO_EDGE. We only use the "real" enum
   name. */

#ifndef GL_CLAMP_TO_EDGE
#define GL_CLAMP_TO_EDGE                  ((GLenum)0x812F)
#endif /* !GL_CLAMP_TO_EDGE */

/* Define for the REPLACE texture model (OpenGL 1.1). */
#ifndef GL_REPLACE
#define GL_REPLACE                        ((GLenum)0x1E01)
#endif /* !GL_REPLACE */

/* Note: all following enums also have an *_EXT version with the same
   enum value as the "real" enum. We only use the "real" enum name in
   Coin code. */

#ifndef GL_MAX_3D_TEXTURE_SIZE
#define GL_MAX_3D_TEXTURE_SIZE            ((GLenum)0x8073)
#endif /* !GL_MAX_3D_TEXTURE_SIZE */
#ifndef GL_PACK_IMAGE_HEIGHT
#define GL_PACK_IMAGE_HEIGHT              ((GLenum)0x806C)
#endif /* !GL_PACK_IMAGE_HEIGHT */
#ifndef GL_PACK_SKIP_IMAGES
#define GL_PACK_SKIP_IMAGES               ((GLenum)0x806B)
#endif /* !GL_PACK_SKIP_IMAGES */
#ifndef GL_PROXY_TEXTURE_2D
#define GL_PROXY_TEXTURE_2D               ((GLenum)0x8064)
#endif /* !GL_PROXY_TEXTURE_2D */
#ifndef GL_PROXY_TEXTURE_3D
#define GL_PROXY_TEXTURE_3D               ((GLenum)0x8070)
#endif /* !GL_PROXY_TEXTURE_3D */
#ifndef GL_TEXTURE_3D
#define GL_TEXTURE_3D                     ((GLenum)0x806F)
#endif /* !GL_TEXTURE_3D */
#ifndef GL_TEXTURE_DEPTH
#define GL_TEXTURE_DEPTH                  ((GLenum)0x8071)
#endif /* !GL_TEXTURE_DEPTH */
#ifndef GL_TEXTURE_WRAP_R
#define GL_TEXTURE_WRAP_R                 ((GLenum)0x8072)
#endif /* !GL_TEXTURE_WRAP_R */
#ifndef GL_UNPACK_IMAGE_HEIGHT
#define GL_UNPACK_IMAGE_HEIGHT            ((GLenum)0x806E)
#endif /* !GL_UNPACK_IMAGE_HEIGHT */
#ifndef GL_UNPACK_SKIP_IMAGES
#define GL_UNPACK_SKIP_IMAGES             ((GLenum)0x806D)
#endif /* !GL_UNPACK_SKIP_IMAGES */
#ifndef GL_COLOR_TABLE_WIDTH
#define GL_COLOR_TABLE_WIDTH              ((GLenum)0x80D9)
#endif /* !GL_COLOR_TABLE_WIDTH */

/* OpenGL multitexture defines. For now we just define for maximum four units */
#ifndef GL_TEXTURE0
#define GL_TEXTURE0                       ((GLenum)0x84C0)
#endif /* !GL_TEXTURE0 */
#ifndef GL_TEXTURE1
#define GL_TEXTURE1                       ((GLenum)0x84C1)
#endif /* !GL_TEXTURE1 */
#ifndef GL_TEXTURE2
#define GL_TEXTURE2                       ((GLenum)0x84C2)
#endif /* !GL_TEXTURE2 */
#ifndef GL_TEXTURE3
#define GL_TEXTURE3                       ((GLenum)0x84C3)
#endif /* !GL_TEXTURE3 */
#ifndef GL_MAX_TEXTURE_UNITS
#define GL_MAX_TEXTURE_UNITS              ((GLenum)0x84E2)
#endif /* !GL_MAX_TEXTURE_UNITS */
#ifndef GL_ACTIVE_TEXTURE
#define GL_ACTIVE_TEXTURE                 ((GLenum)0x84E0)
#endif /* !GL_ACTIVE_TEXTURE */

/* A define from the old EXT_polygon_offset from SGI. This define at
   least missing from Microsoft's OpenGL 1.1 SDK. */
#ifndef GL_POLYGON_OFFSET_EXT
#define GL_POLYGON_OFFSET_EXT             ((GLenum)0x8037)
#endif /* !GL_POLYGON_OFFSET_EXT */

/* color table extension defines */

#ifndef GL_COLOR_TABLE
#define GL_COLOR_TABLE                    0x80D0
#endif /* !GL_COLOR_TABLE */

#ifndef GL_COLOR_INDEX1_EXT
#define GL_COLOR_INDEX1_EXT               0x80E2
#endif /* !GL_COLOR_INDEX1_EXT */

#ifndef GL_COLOR_INDEX2_EXT
#define GL_COLOR_INDEX2_EXT               0x80E3
#endif /* !GL_COLOR_INDEX2_EXT */

#ifndef GL_COLOR_INDEX4_EXT
#define GL_COLOR_INDEX4_EXT               0x80E4
#endif /* !GL_COLOR_INDEX4_EXT */

#ifndef GL_COLOR_INDEX8_EXT
#define GL_COLOR_INDEX8_EXT               0x80E5
#endif /* !GL_COLOR_INDEX8_EXT */

#ifndef GL_COLOR_INDEX12_EXT 
#define GL_COLOR_INDEX12_EXT              0x80E6
#endif /* !GL_COLOR_INDEX12_EXT */

#ifndef GL_COLOR_INDEX16_EXT
#define GL_COLOR_INDEX16_EXT              0x80E7
#endif /* !GL_COLOR_INDEX16_EXT */

#ifndef GL_COLOR_TABLE_FORMAT_EXT
#define GL_COLOR_TABLE_FORMAT_EXT         0x80D8
#endif /* !GL_COLOR_TABLE_FORMAT_EXT */
 
#ifndef GL_COLOR_TABLE_RED_SIZE_EXT
#define GL_COLOR_TABLE_RED_SIZE_EXT       0x80DA
#endif /* !GL_COLOR_TABLE_RED_SIZE_EXT */

#ifndef GL_COLOR_TABLE_GREEN_SIZE_EXT
#define GL_COLOR_TABLE_GREEN_SIZE_EXT     0x80DB
#endif /* !GL_COLOR_TABLE_GREEN_SIZE_EXT */

#ifndef GL_COLOR_TABLE_BLUE_SIZE_EXT
#define GL_COLOR_TABLE_BLUE_SIZE_EXT      0x80DC
#endif /* !GL_COLOR_TABLE_BLUE_SIZE_EXT */

#ifndef GL_COLOR_TABLE_ALPHA_SIZE_EXT
#define GL_COLOR_TABLE_ALPHA_SIZE_EXT     0x80DD
#endif /* !GL_COLOR_TABLE_ALPHA_SIZE_EXT */

#ifndef GL_COLOR_TABLE_LUMINANCE_SIZE_EXT
#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE
#endif /* !GL_COLOR_TABLE_LUMINANCE_SIZE_EXT */

#ifndef GL_COLOR_TABLE_INTENSITY_SIZE_EXT
#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF
#endif /* !GL_COLOR_TABLE_INTENSITY_SIZE_EXT */

#ifndef GL_TEXTURE_INDEX_SIZE_EXT
#define GL_TEXTURE_INDEX_SIZE_EXT         0x80ED
#endif /* !GL_TEXTURE_INDEX_SIZE_EXT */

/* texture compression extension defines */

#ifndef GL_COMPRESSED_ALPHA_ARB
#define GL_COMPRESSED_ALPHA_ARB           0x84E9
#endif /* !GL_COMPRESSED_ALPHA_ARB */

#ifndef GL_COMPRESSED_LUMINANCE_ARB
#define GL_COMPRESSED_LUMINANCE_ARB       0x84EA
#endif /* !GL_COMPRESSED_LUMINANCE_ARB */

#ifndef GL_COMPRESSED_LUMINANCE_ALPHA_ARB
#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB
#endif /* !GL_COMPRESSED_LUMINANCE_ALPHA_ARB */

#ifndef GL_COMPRESSED_INTENSITY_ARB
#define GL_COMPRESSED_INTENSITY_ARB       0x84EC
#endif /* !GL_COMPRESSED_INTENSITY_ARB */

#ifndef GL_COMPRESSED_RGB_ARB
#define GL_COMPRESSED_RGB_ARB             0x84ED
#endif /* !GL_COMPRESSED_RGB_ARB */

#ifndef GL_COMPRESSED_RGBA_ARB
#define GL_COMPRESSED_RGBA_ARB            0x84EE
#endif /* !GL_COMPRESSED_RGBA_ARB */

#ifndef GL_TEXTURE_COMPRESSION_HINT_ARB
#define GL_TEXTURE_COMPRESSION_HINT_ARB   0x84EF
#endif /* !GL_TEXTURE_COMPRESSION_HINT_ARB */

#ifndef GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB
#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0
#endif /* !GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */

#ifndef GL_TEXTURE_COMPRESSED_ARB
#define GL_TEXTURE_COMPRESSED_ARB         0x86A1
#endif /* !GL_TEXTURE_COMPRESSED_ARB */

#ifndef GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2
#endif /* !GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */

#ifndef GL_COMPRESSED_TEXTURE_FORMATS_ARB
#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3
#endif /* !GL_COMPRESSED_TEXTURE_FORMATS_ARB */


/* glBlendEquation defines */

#ifndef GL_MIN
#define GL_MIN 0x8007
#endif /* GL_MIN */
#ifndef GL_MAX
#define GL_MAX 0x8008
#endif /* GL_MAX */
#ifndef GL_FUNC_ADD
#define GL_FUNC_ADD 0x8006
#endif /* GL_FUNC_ADD */
#ifndef GL_FUNC_SUBTRACT
#define GL_FUNC_SUBTRACT 0x800A
#endif /* GL_FUNC_SUBTRACT */
#ifndef GL_FUNC_REVERSE_SUBTRACT
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
#endif /* GL_FUNC_REVERSE_SUBTRACT */


/*** GL enums, end ****************************************************/
/**********************************************************************/


/* GLU enums we use are duplicated, because we should be able to
   compile without GLU and then pick it up and use it at run-time on
   some systems. */

/* gluGetString */
#ifndef GLU_VERSION
#define GLU_VERSION ((GLenum)100800)
#endif /* ! GLU_VERSION */
#ifndef GLU_EXTENSIONS
#define GLU_EXTENSIONS ((GLenum)100801)
#endif /* ! GLU_EXTENSIONS */

/* NurbsDisplay */
#ifndef GLU_OUTLINE_POLYGON
#define GLU_OUTLINE_POLYGON ((GLenum)100240)
#endif /* ! GLU_OUTLINE_POLYGON */
#ifndef GLU_OUTLINE_PATCH
#define GLU_OUTLINE_PATCH ((GLenum)100241)
#endif /* ! GLU_OUTLINE_PATCH */

/* NurbsCallback */
#ifndef GLU_NURBS_ERROR
#define GLU_NURBS_ERROR ((GLenum)100103)
#endif /* ! GLU_NURBS_ERROR */
#ifndef GLU_ERROR
#define GLU_ERROR ((GLenum)100103)
#endif /* ! GLU_ERROR */
#ifndef GLU_NURBS_BEGIN
#define GLU_NURBS_BEGIN ((GLenum)100164)
#endif /* ! GLU_NURBS_BEGIN */
#ifndef GLU_NURBS_VERTEX
#define GLU_NURBS_VERTEX ((GLenum)100165)
#endif /* ! GLU_NURBS_VERTEX */
#ifndef GLU_NURBS_NORMAL
#define GLU_NURBS_NORMAL ((GLenum)100166)
#endif /* ! GLU_NURBS_NORMAL */
#ifndef GLU_NURBS_COLOR
#define GLU_NURBS_COLOR ((GLenum)100167)
#endif /* ! GLU_NURBS_COLOR */
#ifndef GLU_NURBS_TEXTURE_COORD
#define GLU_NURBS_TEXTURE_COORD ((GLenum)100168)
#endif /* ! GLU_NURBS_TEXTURE_COORD */
#ifndef GLU_NURBS_END
#define GLU_NURBS_END ((GLenum)100169)
#endif /* ! GLU_NURBS_END */
#ifndef GLU_NURBS_BEGIN_DATA
#define GLU_NURBS_BEGIN_DATA ((GLenum)100170)
#endif /* ! GLU_NURBS_BEGIN_DATA */
#ifndef GLU_NURBS_VERTEX_DATA
#define GLU_NURBS_VERTEX_DATA ((GLenum)100171)
#endif /* ! GLU_NURBS_VERTEX_DATA */
#ifndef GLU_NURBS_NORMAL_DATA
#define GLU_NURBS_NORMAL_DATA ((GLenum)100172)
#endif /* ! GLU_NURBS_NORMAL_DATA */
#ifndef GLU_NURBS_COLOR_DATA
#define GLU_NURBS_COLOR_DATA ((GLenum)100173)
#endif /* ! GLU_NURBS_COLOR_DATA */
#ifndef GLU_NURBS_TEXTURE_COORD_DATA
#define GLU_NURBS_TEXTURE_COORD_DATA ((GLenum)100174)
#endif /* ! GLU_NURBS_TEXTURE_COORD_DATA */
#ifndef GLU_NURBS_END_DATA
#define GLU_NURBS_END_DATA ((GLenum)100175)
#endif /* ! GLU_NURBS_END_DATA */

/* NurbsProperty */
#ifndef GLU_AUTO_LOAD_MATRIX
#define GLU_AUTO_LOAD_MATRIX ((GLenum)100200)
#endif /* ! GLU_AUTO_LOAD_MATRIX */
#ifndef GLU_CULLING
#define GLU_CULLING ((GLenum)100201)
#endif /* ! GLU_CULLING */
#ifndef GLU_SAMPLING_TOLERANCE
#define GLU_SAMPLING_TOLERANCE ((GLenum)100203)
#endif /* ! GLU_SAMPLING_TOLERANCE */
#ifndef GLU_DISPLAY_MODE
#define GLU_DISPLAY_MODE ((GLenum)100204)
#endif /* ! GLU_DISPLAY_MODE */
#ifndef GLU_PARAMETRIC_TOLERANCE
#define GLU_PARAMETRIC_TOLERANCE ((GLenum)100202)
#endif /* ! GLU_PARAMETRIC_TOLERANCE */
#ifndef GLU_SAMPLING_METHOD
#define GLU_SAMPLING_METHOD ((GLenum)100205)
#endif /* ! GLU_SAMPLING_METHOD */
#ifndef GLU_U_STEP
#define GLU_U_STEP ((GLenum)100206)
#endif /* ! GLU_U_STEP */
#ifndef GLU_V_STEP
#define GLU_V_STEP ((GLenum)100207)
#endif /* ! GLU_V_STEP */
#ifndef GLU_NURBS_MODE
#define GLU_NURBS_MODE ((GLenum)100160)
#endif /* ! GLU_NURBS_MODE */
#ifndef GLU_NURBS_TESSELLATOR
#define GLU_NURBS_TESSELLATOR ((GLenum)100161)
#endif /* ! GLU_NURBS_TESSELLATOR */
#ifndef GLU_NURBS_RENDERER
#define GLU_NURBS_RENDERER ((GLenum)100162)
#endif /* ! GLU_NURBS_RENDERER */

/* NurbsSampling */
#ifndef GLU_OBJECT_PARAMETRIC_ERROR
#define GLU_OBJECT_PARAMETRIC_ERROR ((GLenum)100208)
#endif /* ! GLU_OBJECT_PARAMETRIC_ERROR */
#ifndef GLU_OBJECT_PATH_LENGTH
#define GLU_OBJECT_PATH_LENGTH ((GLenum)100209)
#endif /* ! GLU_OBJECT_PATH_LENGTH */
#ifndef GLU_PATH_LENGTH
#define GLU_PATH_LENGTH ((GLenum)100215)
#endif /* ! GLU_PATH_LENGTH */
#ifndef GLU_PARAMETRIC_ERROR
#define GLU_PARAMETRIC_ERROR ((GLenum)100216)
#endif /* ! GLU_PARAMETRIC_ERROR */
#ifndef GLU_DOMAIN_DISTANCE
#define GLU_DOMAIN_DISTANCE ((GLenum)100217)
#endif /* ! GLU_DOMAIN_DISTANCE */

/* NurbsTrim */
#ifndef GLU_MAP1_TRIM_2
#define GLU_MAP1_TRIM_2 ((GLenum)100210)
#endif /* ! GLU_MAP1_TRIM_2 */
#ifndef GLU_MAP1_TRIM_3
#define GLU_MAP1_TRIM_3 ((GLenum)100211)
#endif /* ! GLU_MAP1_TRIM_3 */

/* QuadricDrawStyle */
#ifndef GLU_POINT
#define GLU_POINT ((GLenum)100010)
#endif /* ! GLU_POINT */
#ifndef GLU_LINE
#define GLU_LINE ((GLenum)100011)
#endif /* ! GLU_LINE */
#ifndef GLU_FILL
#define GLU_FILL ((GLenum)100012)
#endif /* ! GLU_FILL */
#ifndef GLU_SILHOUETTE
#define GLU_SILHOUETTE ((GLenum)10001)
#endif /* ! GLU_SILHOUETTE */

/*** GLU enums, end ***************************************************/
/**********************************************************************/

#endif /* ! COIN_GL_H */
