{
  Translation of the Mesa GL headers for FreePascal
  Copyright (C) 1999 Sebastian Guenther
  Template for static linking in Win32 environment by Alexander Stohr.

  Original copyright notice:

  Mesa 3-D graphics library
  Version:  3.0
  Copyright (C) 1995-1998  Brian Paul

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General Public
  License as published by the Free Software Foundation; either
  version 2 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Library General Public License for more details.

  You should have received a copy of the GNU Library General Public
  License along with this library; if not, write to the Free
  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
}

{
  You have to enable Macros (compiler switch "-Sm") for compiling this unit!
  This is necessary for supporting different platforms with different calling
  conventions via a single unit.
}

unit GL;


interface

{$DEFINE GL1_0}
{x$DEFINE GL1_1}
{x$DEFINE GL1_2}
{x$DEFINE MESA}                 {enable if you want to use some special mesa extensions}
{x$DEFINE EXTENSIONS}           {enable if you need one/all of extensions}
{x$DEFINE SGI_EXTENSIONS}       {enable if you need one/all of extensions}

{
  *** Note: ***
  There is currently one importants side effect when doing static linking.

  If you include a function statically than its required to be present
  in the supplied DLLs of your OS and Hardware.
  This means if the DLL is not present your program will not run.
  In Win95 it appears that you will be informined you about
  the name of the first missing symbol while loading the executable.
}

{$IFDEF Win32}
  {$DEFINE ogl_dll := external 'opengl32.dll'}
  uses Windows;
{$ELSE}
  {$MESSAGE Unsupported platform.}
{$ENDIF}


// =======================================================
//   Unit specific extensions
// =======================================================

// none - no special init required


// =======================================================
//   GL consts, types and functions
// =======================================================


// -------------------------------------------------------
//   GL types
// -------------------------------------------------------

type
  PSingle   = ^Single;
  PDouble   = ^Double;

  GLvoid    = Pointer;
  GLboolean = Byte;

  GLbyte    = ShortInt; // 1-byte signed
  GLshort   = Integer;  // 2-byte signed
  GLint     = LongInt;  // 4-byte signed

  GLubyte   = Byte;     // 1-byte unsigned
  GLushort  = Word;     // 2-byte unsigned
  GLuint    = DWord;    // 4-byte signed

  GLsizei   = LongInt;  // 4-byte signed

  GLfloat   = Single;   // single precision float
  GLclampf  = Single;	// single precision float in [0,1]
  GLdouble  = Double;   // double precision float
  GLclampd  = Double;	// double precision float in [0,1]

  GLenum    = DWord;

type
  GLbitfield = DWord;  { was an enum - no corresponding thing in pascal }
const
  GL_CURRENT_BIT        = $00000001;
  GL_POINT_BIT          = $00000002;
  GL_LINE_BIT           = $00000004;
  GL_POLYGON_BIT        = $00000008;
  GL_POLYGON_STIPPLE_BIT= $00000010;
  GL_PIXEL_MODE_BIT     = $00000020;
  GL_LIGHTING_BIT       = $00000040;
  GL_FOG_BIT            = $00000080;
  GL_DEPTH_BUFFER_BIT   = $00000100;
  GL_ACCUM_BUFFER_BIT   = $00000200;
  GL_STENCIL_BUFFER_BIT = $00000400;
  GL_VIEWPORT_BIT       = $00000800;
  GL_TRANSFORM_BIT      = $00001000;
  GL_ENABLE_BIT         = $00002000;
  GL_COLOR_BUFFER_BIT   = $00004000;
  GL_HINT_BIT           = $00008000;
  GL_EVAL_BIT           = $00010000;
  GL_LIST_BIT           = $00020000;
  GL_TEXTURE_BIT        = $00040000;
  GL_SCISSOR_BIT        = $00080000;
  GL_ALL_ATTRIB_BITS    = $000fffff;


// -------------------------------------------------------
//   GL constants
// -------------------------------------------------------

{$IFDEF GL1_0}
%GLDeclsIF10
{$ENDIF GL1_0}

{$IFDEF GL1_1}
%GLDeclsIF11
{$ENDIF GL1_1}

{$IFDEF GL1_2}
%GLDeclsIF12
{$ENDIF GL1_2}

const
  // Utility
  GL_VENDOR				= $1F00;
  GL_RENDERER				= $1F01;
  GL_VERSION				= $1F02;
  GL_EXTENSIONS				= $1F03;

  // Errors
  GL_INVALID_VALUE			= $0501;
  GL_INVALID_ENUM			= $0500;
  GL_INVALID_OPERATION			= $0502;
  GL_STACK_OVERFLOW			= $0503;
  GL_STACK_UNDERFLOW			= $0504;
  GL_OUT_OF_MEMORY			= $0505;


// -------------------------------------------------------
//   GL extensions constants
// -------------------------------------------------------

{$IFDEF EXTENSIONS}
%GLDeclsIF10Ext
{$ENDIF EXTENSIONS}

{$IFDEF SGI_EXTENSIONS}
%GLDeclsIF10SGI
{$ENDIF SGI_EXTENSIONS}

{$IFDEF MESA}
%GLDeclsIF10Mesa
{$ENDIF MESA}


// -------------------------------------------------------
//   GL procedures and functions
// -------------------------------------------------------

{$IFDEF GL1_0}
%GLProcsPS10
{$ENDIF GL1_0}

{$IFDEF GL1_1}
%GLProcsPS11
{$ENDIF GL1_1}

{$IFDEF GL1_2}
%GLProcsPS12
{$ENDIF GL1_2}


// -------------------------------------------------------
//   GL Extensions
// -------------------------------------------------------

{$IFDEF EXTENSIONS}
%GLProcsPS10Ext
{$ENDIF EXTENSIONS}

// library dependent extensions

{$IFDEF SGI_EXTENSIONS}
%GLProcsPS10SGI
{$ENDIF SGI_EXTENSIONS}

{$ifdef MESA}
%GLProcsPS10Mesa
{$endif MESA}


// =======================================================
// =======================================================

implementation

{BEGIN}{OF INIT}
END.
