/*
Geometric Tools, Inc.
http://www.geometrictools.com
Copyright (c) 1998-2005.  All Rights Reserved

The Wild Magic Library (WM3) source code is supplied under the terms of
the license agreement
    http://www.geometrictools.com/License/WildMagic3License.pdf
and may not be copied or disclosed except in accordance with the terms
of that agreement.

This file evolved by modifications from a version of glext.h that was
downloaded from the site listed in the license below.  The version of the
file is: GL_GLEXT_VERSION 27
*/

/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
** 
** http://oss.sgi.com/projects/FreeB
** 
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
** 
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
** 
** Additional Notice Provisions: This software was created using the
** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
** not been independently verified as being compliant with the OpenGL(R)
** version 1.2.1 Specification.
*/

#ifndef WM3OPENGLEXTENSIONS_H
#define WM3OPENGLEXTENSIONS_H

/*
In order to get the extension mechanism to work on multiple platforms, you
have to go to great pains to unravel the mess that is gl.h, glu.h, and
glext.h.  The _WIN32 situation is fairly easy to handle because gl.h only
supports OpenGL 1.1.  However, Fedora Core 3 Linux has a gl.h that supports
OpenGL 1.3 and it includes glext.h which ships with the Linux tools.  The
following block of code is used to prevent gl.h from being included on Linux.
The OpenGL definitions are, therefore, provided by this extension wrapper.
This block of code and the definitions in the GL_VERSION_1_1 block are not
necessary on _WIN32.
*/
#if defined(__gl_h_) || defined(__GL_H__)
#error gl.h included before Wm3OpenGLExtensions.h
#endif
#if defined(__glext_h_) || defined(__GLEXT_H_)
#error glext.h included before Wm3OpenGLExtensions.h
#endif
#if defined(__gl_ATI_h_)
#error glATI.h included before Wm3OpenGLExtensions.h
#endif

#define __gl_h_
#define __GL_H__
#define __glext_h_
#define __GLEXT_H_
#define __gl_ATI_h_

/*--------------------------------------------------------------------------*/
#if defined(_WIN32)

/*
Normally you need to include windows.h before gl.h and glu.h.  However,
this file defines a lot of symbols that can cause problems with application
code.  In particular, Developer Studio complains about the application
function WindowApplication::GetCharWidth in Wm3GlutApplication.cpp, stating
that it conflicts with GetCharWidthA.  The relevant symbols are instead
defined here:
  gl.h needs APIENTRY, WINGDIAPI
  glu.h needs APIENTRY, CALLBACK, wchar_t
*/

#ifndef APIENTRY
#define WM3_DEFINED_APIENTRY
#if (defined(_MSC_VER) && (_MSC_VER >= 800)) || defined(_STDCALL_SUPPORTED)
#define APIENTRY __stdcall
#else
#define APIENTRY
#endif
#endif

#ifndef CALLBACK
#define WM3_DEFINED_CALLBACK
#if (defined(_MSC_VER) && (_MSC_VER >= 800)) || defined(_STDCALL_SUPPORTED)
#define CALLBACK __stdcall
#else
#define CALLBACK
#endif
#endif

#ifndef WINGDIAPI
#define WM3_DEFINED_WINGDIAPI
#define WINGDIAPI __declspec(dllimport)
#endif

#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif

#else  // Apple, Linux
#define APIENTRY
#define CALLBACK
#define WINGDIAPI extern
#endif

#ifdef __cplusplus
#include <cstddef>
extern "C" {
#else
#include <stddef.h>
#endif

#define WM3_EXT_FULLY_EXISTS     2
#define WM3_EXT_PARTIALLY_EXISTS 1
#define WM3_EXT_DOES_NOT_EXIST   0
