# This is the definition file for all GLUT stuff

%COPY_INTERFACE

{ GLUT API revision history:
 
  GLUT_API_VERSION is updated to reflect incompatible GLUT
  API changes (interface changes, semantic changes, deletions,
  or additions).
 
  GLUT_API_VERSION=1  First public release of GLUT.  11/29/94

  GLUT_API_VERSION=2  Added support for OpenGL/GLX multisampling,
  extension.  Supports new input devices like tablet, dial and button
  box, and Spaceball.  Easy to query OpenGL extensions.

  GLUT_API_VERSION=3  glutMenuStatus added.

  GLUT_API_VERSION=4  glutInitDisplayString, glutWarpPointer,
  glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic
  video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc,
  glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat,
  glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!). }

const
  GLUT_API_VERSION		= 4;

  // Display mode bit masks
  GLUT_RGB                      = 0;
  GLUT_RGBA                     = GLUT_RGB;
  GLUT_INDEX                    = 1;
  GLUT_SINGLE                   = 0;
  GLUT_DOUBLE                   = 2;
  GLUT_ACCUM                    = 4;
  GLUT_ALPHA                    = 8;
  GLUT_DEPTH                    = 16;
  GLUT_STENCIL                  = 32;
  GLUT_MULTISAMPLE              = 128;
  GLUT_STEREO                   = 256;
  GLUT_LUMINANCE                = 512;

  // Mouse buttons
  GLUT_LEFT_BUTTON              = 0;
  GLUT_MIDDLE_BUTTON            = 1;
  GLUT_RIGHT_BUTTON             = 2;

  // Mouse button state
  GLUT_DOWN                     = 0;
  GLUT_UP                       = 1;

  // function keys
  GLUT_KEY_F1			= 1;
  GLUT_KEY_F2			= 2;
  GLUT_KEY_F3			= 3;
  GLUT_KEY_F4			= 4;
  GLUT_KEY_F5			= 5;
  GLUT_KEY_F6			= 6;
  GLUT_KEY_F7			= 7;
  GLUT_KEY_F8			= 8;
  GLUT_KEY_F9			= 9;
  GLUT_KEY_F10			= 10;
  GLUT_KEY_F11			= 11;
  GLUT_KEY_F12			= 12;
  // directional keys
  GLUT_KEY_LEFT			= 100;
  GLUT_KEY_UP			= 101;
  GLUT_KEY_RIGHT		= 102;
  GLUT_KEY_DOWN			= 103;
  GLUT_KEY_PAGE_UP		= 104;
  GLUT_KEY_PAGE_DOWN		= 105;
  GLUT_KEY_HOME			= 106;
  GLUT_KEY_END			= 107;
  GLUT_KEY_INSERT		= 108;

  // Enter / exit state
  GLUT_LEFT                     = 0;
  GLUT_ENTERED                  = 1;

  // Menu usage state
  GLUT_MENU_NOT_IN_USE          = 0;
  GLUT_MENU_IN_USE              = 1;

  // Visibility state
  GLUT_NOT_VISIBLE              = 0;
  GLUT_VISIBLE                  = 1;

  // Window status state
  GLUT_HIDDEN                   = 0;
  GLUT_FULLY_RETAINED           = 1;
  GLUT_PARTIALLY_RETAINED       = 2;
  GLUT_FULLY_COVERED            = 3;

  // Color index component selection values
  GLUT_RED                      = 0;
  GLUT_GREEN                    = 1;
  GLUT_BLUE                     = 2;

  // Layers for use
  GLUT_NORMAL                   = 0;
  GLUT_OVERLAY                  = 1;

  // glutGet parameters
  GLUT_WINDOW_X                 = 100;
  GLUT_WINDOW_Y                 = 101;
  GLUT_WINDOW_WIDTH             = 102;
  GLUT_WINDOW_HEIGHT            = 103;
  GLUT_WINDOW_BUFFER_SIZE       = 104;
  GLUT_WINDOW_STENCIL_SIZE      = 105;
  GLUT_WINDOW_DEPTH_SIZE        = 106;
  GLUT_WINDOW_RED_SIZE          = 107;
  GLUT_WINDOW_GREEN_SIZE        = 108;
  GLUT_WINDOW_BLUE_SIZE         = 109;
  GLUT_WINDOW_ALPHA_SIZE        = 110;
  GLUT_WINDOW_ACCUM_RED_SIZE    = 111;
  GLUT_WINDOW_ACCUM_GREEN_SIZE  = 112;
  GLUT_WINDOW_ACCUM_BLUE_SIZE   = 113;
  GLUT_WINDOW_ACCUM_ALPHA_SIZE  = 114;
  GLUT_WINDOW_DOUBLEBUFFER      = 115;
  GLUT_WINDOW_RGBA              = 116;
  GLUT_WINDOW_PARENT            = 117;
  GLUT_WINDOW_NUM_CHILDREN      = 118;
  GLUT_WINDOW_COLORMAP_SIZE     = 119;
  GLUT_WINDOW_NUM_SAMPLES       = 120;
  GLUT_WINDOW_STEREO            = 121;
  GLUT_WINDOW_CURSOR            = 122;
  GLUT_SCREEN_WIDTH             = 200;
  GLUT_SCREEN_HEIGHT            = 201;
  GLUT_SCREEN_WIDTH_MM          = 202;
  GLUT_SCREEN_HEIGHT_MM         = 203;
  GLUT_MENU_NUM_ITEMS           = 300;
  GLUT_DISPLAY_MODE_POSSIBLE    = 400;
  GLUT_INIT_WINDOW_X            = 500;
  GLUT_INIT_WINDOW_Y            = 501;
  GLUT_INIT_WINDOW_WIDTH        = 502;
  GLUT_INIT_WINDOW_HEIGHT       = 503;
  GLUT_INIT_DISPLAY_MODE        = 504;
  GLUT_ELAPSED_TIME             = 700;
  GLUT_WINDOW_FORMAT_ID         = 123;

  // glutDeviceGet parameters
  GLUT_HAS_KEYBOARD             = 600;
  GLUT_HAS_MOUSE                = 601;
  GLUT_HAS_SPACEBALL            = 602;
  GLUT_HAS_DIAL_AND_BUTTON_BOX  = 603;
  GLUT_HAS_TABLET               = 604;
  GLUT_NUM_MOUSE_BUTTONS        = 605;
  GLUT_NUM_SPACEBALL_BUTTONS    = 606;
  GLUT_NUM_BUTTON_BOX_BUTTONS   = 607;
  GLUT_NUM_DIALS                = 608;
  GLUT_NUM_TABLET_BUTTONS       = 609;
  GLUT_DEVICE_IGNORE_KEY_REPEAT = 610;
  GLUT_DEVICE_KEY_REPEAT        = 611;
  GLUT_HAS_JOYSTICK             = 612;
  GLUT_OWNS_JOYSTICK            = 613;
  GLUT_JOYSTICK_BUTTONS         = 614;
  GLUT_JOYSTICK_AXES            = 615;
  GLUT_JOYSTICK_POLL_RATE       = 616;

  // glutLayerGet parameters
  GLUT_OVERLAY_POSSIBLE         = 800;
  GLUT_LAYER_IN_USE             = 801;
  GLUT_HAS_OVERLAY              = 802;
  GLUT_TRANSPARENT_INDEX        = 803;
  GLUT_NORMAL_DAMAGED           = 804;
  GLUT_OVERLAY_DAMAGED          = 805;

  // glutVideoResizeGet parameters
  GLUT_VIDEO_RESIZE_POSSIBLE    = 900;
  GLUT_VIDEO_RESIZE_IN_USE      = 901;
  GLUT_VIDEO_RESIZE_X_DELTA     = 902;
  GLUT_VIDEO_RESIZE_Y_DELTA     = 903;
  GLUT_VIDEO_RESIZE_WIDTH_DELTA = 904;
  GLUT_VIDEO_RESIZE_HEIGHT_DELTA= 905;
  GLUT_VIDEO_RESIZE_X           = 906;
  GLUT_VIDEO_RESIZE_Y           = 907;
  GLUT_VIDEO_RESIZE_WIDTH       = 908;
  GLUT_VIDEO_RESIZE_HEIGHT      = 909;

  // glutGetModifiers return mask
  GLUT_ACTIVE_SHIFT             = 1;
  GLUT_ACTIVE_CTRL              = 2;
  GLUT_ACTIVE_ALT               = 4;

  // glutSetCursor parameters
  // Basic arrows
  GLUT_CURSOR_RIGHT_ARROW	= 0;
  GLUT_CURSOR_LEFT_ARROW	= 1;
  // Symbolic cursor shapes
  GLUT_CURSOR_INFO		= 2;
  GLUT_CURSOR_DESTROY		= 3;
  GLUT_CURSOR_HELP		= 4;
  GLUT_CURSOR_CYCLE		= 5;
  GLUT_CURSOR_SPRAY		= 6;
  GLUT_CURSOR_WAIT		= 7;
  GLUT_CURSOR_TEXT		= 8;
  GLUT_CURSOR_CROSSHAIR		= 9;
  // Directional cursors
  GLUT_CURSOR_UP_DOWN		= 10;
  GLUT_CURSOR_LEFT_RIGHT	= 11;
  // Sizing cursors
  GLUT_CURSOR_TOP_SIDE		= 12;
  GLUT_CURSOR_BOTTOM_SIDE	= 13;
  GLUT_CURSOR_LEFT_SIDE		= 14;
  GLUT_CURSOR_RIGHT_SIDE	= 15;
  GLUT_CURSOR_TOP_LEFT_CORNER	= 16;
  GLUT_CURSOR_TOP_RIGHT_CORNER	= 17;
  GLUT_CURSOR_BOTTOM_RIGHT_CORNER = 18;
  GLUT_CURSOR_BOTTOM_LEFT_CORNER = 19;
  // Inherit from parent window
  GLUT_CURSOR_INHERIT		= 100;
  // Blank cursor
  GLUT_CURSOR_NONE		= 101;
  // Fullscreen crosshair (if available)
  GLUT_CURSOR_FULL_CROSSHAIR	= 102;

type

  // GLUT menu sub-API
  TGlutCreateMenuFunc = procedure(arg: Int); cdecl;

  // GLUT window callback sub-API
  TGlutDisplayFunc = procedure; cdecl;
  TGlutReshapeFunc = procedure(width, height: Int); cdecl;
  TGlutKeyboardFunc = procedure(key: Char; x, y: Int); cdecl;
  TGlutMouseFunc = procedure(button, state, x, y: Int); cdecl;
  TGlutMotionFunc = procedure(x, y: Int); cdecl;
  TGlutPassiveMotionFunc = procedure(x, y: Int); cdecl;
  TGlutEntryFunc = procedure(x, y: Int); cdecl;
  TGlutVisibilityFunc = procedure(state: Int); cdecl;
  TGlutIdleFunc = procedure; cdecl;
  TGlutTimerFunc = procedure(value: Int); cdecl;
  TGlutMenuStateFunc = procedure(state: Int); cdecl;
  TGlutSpecialFunc = procedure(key, x, y: Int); cdecl;
  TGlutSpaceballMotionFunc = procedure(x, y, z: Int); cdecl;
  TGlutSpaceballRotateFunc = procedure(x, y, z: Int); cdecl;
  TGlutSpaceballButtonFunc = procedure(button, state: Int); cdecl;
  TGlutButtonBoxFunc = procedure(button, state: Int); cdecl;
  TGlutDialsFunc = procedure(dial, value: Int); cdecl;
  TGlutTabletMotionFunc = procedure(x, y: Int); cdecl;
  TGlutTabletButtonFunc = procedure(button, state, x, y: Int); cdecl;
  TGlutMenuStatusFunc = procedure(status, x, y: Int); cdecl;
  TGlutOverlayDisplayFunc = procedure; cdecl;
  TGlutWindowStatusFunc = procedure(state: Int); cdecl;
  TGlutKeyboardUpFunc = procedure(key: Char; x, y: Int); cdecl;
  TGlutSpecialUpFunc = procedure(key, x, y: Int); cdecl;
  TGlutJoystickFunc = procedure(buttonMask: UnsignedInt; x, y, z: Int); cdecl;

const
// GLUT device control sub-API
  // glutSetKeyRepeat modes.
  GLUT_KEY_REPEAT_OFF		= 0;
  GLUT_KEY_REPEAT_ON		= 1;
  GLUT_KEY_REPEAT_DEFAULT	= 2;

  // Joystick button masks
  GLUT_JOYSTICK_BUTTON_A	= 1;
  GLUT_JOYSTICK_BUTTON_B	= 2;
  GLUT_JOYSTICK_BUTTON_C	= 4;
  GLUT_JOYSTICK_BUTTON_D	= 8;

// GLUT game mode sub-API
  // glutGameModeGet
  GLUT_GAME_MODE_ACTIVE         = 0;
  GLUT_GAME_MODE_POSSIBLE       = 1;
  GLUT_GAME_MODE_WIDTH          = 2;
  GLUT_GAME_MODE_HEIGHT         = 3;
  GLUT_GAME_MODE_PIXEL_DEPTH    = 4;
  GLUT_GAME_MODE_REFRESH_RATE   = 5;
  GLUT_GAME_MODE_DISPLAY_CHANGED= 6;


var
%END


#=====================================================================
# Procedures and functions
#=====================================================================

%PROCS
// GLUT initialization sub-API
  glutInit: procedure(argcp: PInt; argv: PPChar);
  glutInitDisplayMode: procedure(mode: UnsignedInt);
  glutInitDisplayString: procedure(const AString: PChar);
  glutInitWindowPosition: procedure(x, y: Int);
  glutInitWindowSize: procedure(width, height: Int);
  glutMainLoop: procedure;

// GLUT window sub-API
  glutCreateWindow: function(const title: PChar): Int;
  glutCreateSubWindow: function(win, x, y, width, height: Int): Int;
  glutDestroyWindow: procedure(win: Int);
  glutPostRedisplay: procedure;
  glutPostWindowRedisplay: procedure(win: Int);
  glutSwapBuffers: procedure;
  glutGetWindow: function: Int;
  glutSetWindow: procedure(win: Int);
  glutSetWindowTitle: procedure(const title: PChar);
  glutSetIconTitle: procedure(title: PChar);
  glutPositionWindow: procedure(x, y: Int);
  glutReshapeWindow: procedure(width, height: Int);
  glutPopWindow: procedure;
  glutPushWindow: procedure;
  glutIconifyWindow: procedure;
  glutShowWindow: procedure;
  glutHideWindow: procedure;
  glutFullScreen: procedure;
  glutSetCursor: procedure(cursor: Int);
  glutWarpPointer: procedure(x, y: Int);

// GLUT overlay sub-API
  glutEstablishOverlay: procedure;
  glutRemoveOverlay: procedure;
  glutUseLayer: procedure(layer: GLenum);
  glutPostOverlayRedisplay: procedure;
  glutPostWindowOverlayRedisplay: procedure(win: Int);
  glutShowOverlay: procedure;
  glutHideOverlay: procedure;

// GLUT menu sub-API
  glutCreateMenu: function(func: TGlutCreateMenuFunc): Int;
  glutDestroyMenu: procedure(menu: Int);
  glutGetMenu: function: Int;
  glutSetMenu: procedure(menu: Int);
  glutAddMenuEntry: procedure(const ALabel: PChar; value: Int);
  glutAddSubMenu: procedure(const ALabel: PChar; submenu: Int);
  glutChangeToMenuEntry: procedure(item: Int; const ALabel: PChar; value: Int);
  glutChangeToSubMenu: procedure(item: Int; const ALabel: PChar; submenu: Int);
  glutRemoveMenuItem: procedure(item: Int);
  glutAttachMenu: procedure(button: Int);
  glutDetachMenu: procedure(button: Int);

// GLUT window callback sub-API
  glutDisplayFunc: procedure(func: TGlutDisplayFunc);
  glutReshapeFunc: procedure(func: TGlutReshapeFunc);
  glutKeyboardFunc: procedure(func: TGlutKeyboardFunc);
  glutMouseFunc: procedure(func: TGlutMouseFunc);
  glutMotionFunc: procedure(func: TGlutMotionFunc);
  glutPassiveMotionFunc: procedure(func: TGlutPassiveMotionFunc);
  glutEntryFunc: procedure(func: TGlutEntryFunc);
  glutIdleFunc: procedure(func: TGlutIdleFunc);
  glutTimerFunc: procedure(millis: UnsignedInt; func: TGlutTimerFunc; value: Int);
  glutMenuStateFunc: procedure(func: TGlutMenuStateFunc);
  glutSpecialFunc: procedure(func: TGlutSpecialFunc);
  glutSpaceballMotionFunc: procedure(func: TGlutSpaceballMotionFunc);
  glutSpaceballRotateFunc: procedure(func: TGlutSpaceballRotateFunc);
  glutSpaceballButtonFunc: procedure(func: TGlutSpaceballButtonFunc);
  glutButtonBoxFunc: procedure(func: TGlutButtonBoxFunc);
  glutDialsFunc: procedure(func: TGlutDialsFunc);
  glutTabletMotionFunc: procedure(func: TGlutTabletMotionFunc);
  glutTabletButtonFunc: procedure(func: TGlutTabletButtonFunc);
  glutMenuStatusFunc: procedure(func: TGlutMenuStatusFunc);
  glutOverlayDisplayFunc: procedure(func: TGlutOverlayDisplayFunc);
  glutWindowStatusFunc: procedure(func: TGlutWindowStatusFunc);
  glutKeyboardUpFunc: procedure(func: TGlutKeyboardUpFunc);
  glutSpecialUpFunc: procedure(func: TGlutSpecialUpFunc);
  glutJoystickFunc: procedure(func: TGlutJoystickFunc; pollinterval: Int);

// GLUT color index sub-API
  glutSetColor: procedure(index: Int; red, green, blue: GLfloat);
  glutGetColor: function(ndx, component: Int): GLfloat;
  glutCopyColormap: procedure(win: Int);

// GLUT state retrieval sub-API
  glutGet: function(AType: GLEnum): Int;
  glutDeviceGet: function(AType: GLEnum): Int;
  glutExtensionSupported: function(const name: PChar): Int;
  glutGetModifiers: function: Int;
  glutLayerGet: function(AType: GLEnum): Int;

// GLUT font sub-API
  glutBitmapCharacter: procedure(font: Pointer; character: Int);
  glutBitmapWidth: function(font: Pointer; character: Int): Int;
  glutStrokeCharacter: procedure(font: Pointer; character: Int);
  glutStrokeWidth: function(font: Pointer; character: Int): Int;
  glutBitmapLength: function(font: Pointer; const AString: PChar): Int;
  glutStrokeLength: function(font: Pointer; const AString: PChar): Int;

// GLUT pre-built models sub-API
  glutWireSphere: procedure(radius: GLdouble; slices, stacks: GLint);
  glutSolidSphere: procedure(radius: GLdouble; slices, stacks: GLint);
  glutWireCone: procedure(base: GLdouble; height: GLdouble; slices, stacks: GLint);
  glutSolidCone: procedure(base: GLdouble; height: GLdouble; slices, stacks: GLint);
  glutWireCube: procedure(size: GLdouble);
  glutSolidCube: procedure(size: GLdouble);
  glutWireTorus: procedure(innerRadius, outerRadius: GLdouble; sides, rings: GLint);
  glutSolidTorus: procedure(innerRadius, outerRadius: GLdouble; sides, rings: GLint);
  glutWireDodecahedron: procedure;
  glutSolidDodecahedron: procedure;
  glutWireTeapot: procedure(size: GLdouble);
  glutSolidTeapot: procedure(size: GLdouble);
  glutWireOctahedron: procedure;
  glutSolidOctahedron: procedure;
  glutWireTetrahedron: procedure;
  glutSolidTetrahedron: procedure;
  glutWireIcosahedron: procedure;
  glutSolidIcosahedron: procedure;

// GLUT video resize sub-API
  glutVideoResizeGet: function(param: GLenum): Int;
  glutSetupVideoResizing: procedure;
  glutStopVideoResizing: procedure;
  glutVideoResize: procedure(x, y, width, height: Int);
  glutVideoPan: procedure(x, y, width, height: Int);

// GLUT debugging sub-API
  glutReportErrors: procedure;

// GLUT device control sub-API
  glutIgnoreKeyRepeat: procedure(ignore: Int);
  glutSetKeyRepeat: procedure(repeatMode: Int);
  glutForceJoystickFunc: procedure;

// GLUT game mode sub-API
  glutGameModeString: procedure(const AString: PChar);
  glutEnterGameMode: function: Integer;
  glutLeaveGameMode: procedure;
  glutGameModeGet: function(mode: GLEnum): Int;

%END
