#require <GL/gl.sbp>
#require <GL/glu.sbp>

Const GLUT_XLIB_IMPLEMENTATION = 13

Const GLUT_RGB = 0
Const GLUT_RGBA = GLUT_RGB
Const GLUT_INDEX = 1
Const GLUT_SINGLE = 0
Const GLUT_DOUBLE = 2
Const GLUT_ACCUM = 4
Const GLUT_ALPHA = 8
Const GLUT_DEPTH = 16
Const GLUT_STENCIL = 32
Const GLUT_MULTISAMPLE = 128
Const GLUT_STEREO = 256
Const GLUT_LUMINANCE = 512

Const GLUT_LEFT_BUTTON = 0
Const GLUT_MIDDLE_BUTTON = 1
Const GLUT_RIGHT_BUTTON = 2

Const GLUT_DOWN = 0
Const GLUT_UP = 1

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

Const GLUT_LEFT = 0
Const GLUT_ENTERED = 1

Const GLUT_MENU_NOT_IN_USE = 0
Const GLUT_MENU_IN_USE = 1

Const GLUT_NOT_VISIBLE = 0
Const GLUT_VISIBLE = 1

Const GLUT_HIDDEN = 0
Const GLUT_FULLY_RETAINED = 1
Const GLUT_PARTIALLY_RETAINED = 2
Const GLUT_FULLY_COVERED = 3

Const GLUT_RED = 0
Const GLUT_GREEN = 1
Const GLUT_BLUE = 2

Const GLUT_NORMAL = 0
Const GLUT_OVERLAY = 1

Const GLUT_STROKE_ROMAN = 0
Const GLUT_STROKE_MONO_ROMAN = 1

Const GLUT_BITMAP_9_BY_15 = 2
Const GLUT_BITMAP_8_BY_13 = 3
Const GLUT_BITMAP_TIMES_ROMAN_10 = 4
Const GLUT_BITMAP_TIMES_ROMAN_24 = 5
Const GLUT_BITMAP_HELVETICA_10 = 6
Const GLUT_BITMAP_HELVETICA_12 = 7
Const GLUT_BITMAP_HELVETICA_18 = 8

Dim glutStrokeRoman As VoidPtr
Dim glutStrokeMonoRoman As VoidPtr

Dim glutBitmap9By15 As VoidPtr
Dim glutBitmap8By13 As VoidPtr
Dim glutBitmapTimesRoman10 As VoidPtr
Dim glutBitmapTimesRoman24 As VoidPtr
Dim glutBitmapHelvetica10 As VoidPtr
Dim glutBitmapHelvetica12 As VoidPtr
Dim glutBitmapHelvetica18 As VoidPtr

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

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

Const GLUT_OVERLAY_POSSIBLE = 800
Const GLUT_LAYER_IN_USE = 801
Const GLUT_HAS_OVERLAY = 802
Const GLUT_TRANSPARENT_INDEX = 803
Const GLUT_NORMAL_DAMAGED = 804
Const GLUT_OVERLAY_DAMAGED = 805

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

Const GLUT_ACTIVE_SHIFT = 1
Const GLUT_ACTIVE_CTRL = 2
Const GLUT_ACTIVE_ALT = 4

Const GLUT_CURSOR_RIGHT_ARROW = 0
Const GLUT_CURSOR_LEFT_ARROW = 1
Const GLUT_CURSOR_INFO = 2
Const GLUT_CURSOR_DESTROY = 3
Const GLUT_CURSOR_HELP = 4
Const GLUT_CURSOR_CYCLE = 5
Const GLUT_CURSOR_SPRAY = 6
Const GLUT_CURSOR_WAIT = 7
Const GLUT_CURSOR_TEXT = 8
Const GLUT_CURSOR_CROSSHAIR = 9
Const GLUT_CURSOR_UP_DOWN = 10
Const GLUT_CURSOR_LEFT_RIGHT = 11
Const GLUT_CURSOR_TOP_SIDE = 12
Const GLUT_CURSOR_BOTTOM_SIDE = 13
Const GLUT_CURSOR_LEFT_SIDE = 14
Const GLUT_CURSOR_RIGHT_SIDE = 15
Const GLUT_CURSOR_TOP_LEFT_CORNER = 16
Const GLUT_CURSOR_TOP_RIGHT_CORNER = 17
Const GLUT_CURSOR_BOTTOM_RIGHT_CORNER = 18
Const GLUT_CURSOR_BOTTOM_LEFT_CORNER = 19
Const GLUT_CURSOR_INHERIT = 100
Const GLUT_CURSOR_NONE = 101
Const GLUT_CURSOR_FULL_CROSSHAIR = 102

Declare Sub glutInit Lib "glut32" (argcp As *Long, argv As *PSTR)
Declare Sub glutInitDisplayMode Lib "glut32" (mode As DWord)
Declare Sub glutInitDisplayString Lib "glut32" (pstring As PSTR)
Declare Sub glutInitWindowPosition Lib "glut32" (x As Long, y As Long)
Declare Sub glutInitWindowSize Lib "glut32" (width As Long, height As Long)
Declare Sub glutMainLoop Lib "glut32" ()
Declare Function glutCreateWindow Lib "glut32" (title As PSTR) As Long
Declare Function glutCreateSubWindow Lib "glut32" (win As Long, x As Long, y As Long, width As Long, height As Long) As Long
Declare Sub glutDestroyWindow Lib "glut32" (win As Long)
Declare Sub glutPostRedisplay Lib "glut32" ()
Declare Sub glutPostWindowRedisplay Lib "glut32" (win As Long)
Declare Sub glutSwapBuffers Lib "glut32" ()
Declare Function glutGetWindow Lib "glut32" () As Long
Declare Sub glutSetWindow Lib "glut32" (win As Long)
Declare Sub glutSetWindowTitle Lib "glut32" (title As PSTR)
Declare Sub glutSetIconTitle Lib "glut32" (title As PSTR)
Declare Sub glutPositionWindow Lib "glut32" (x As Long, y As Long)
Declare Sub glutReshapeWindow Lib "glut32" (width As Long, height As Long)
Declare Sub glutPopWindow Lib "glut32" ()
Declare Sub glutPushWindow Lib "glut32" ()
Declare Sub glutIconifyWindow Lib "glut32" ()
Declare Sub glutShowWindow Lib "glut32" ()
Declare Sub glutHideWindow Lib "glut32" ()
Declare Sub glutFullScreen Lib "glut32" ()
Declare Sub glutSetCursor Lib "glut32" (cursor As Long)
Declare Sub glutWarpPointer Lib "glut32" (x As Long, y As Long)
Declare Sub glutEstablishOverlay Lib "glut32" ()
Declare Sub glutRemoveOverlay Lib "glut32" ()
Declare Sub glutUseLayer Lib "glut32" (layer As GLenum)
Declare Sub glutPostOverlayRedisplay Lib "glut32" ()
Declare Sub glutPostWindowOverlayRedisplay Lib "glut32" (win As Long)
Declare Sub glutShowOverlay Lib "glut32" ()
Declare Sub glutHideOverlay Lib "glut32" ()
Declare Function glutCreateMenu Lib "glut32" (i As VoidPtr) As Long
Declare Sub glutDestroyMenu Lib "glut32" (menu As Long)
Declare Function glutGetMenu Lib "glut32" () As Long
Declare Sub glutSetMenu Lib "glut32" (menu As Long)
Declare Sub glutAddMenuEntry Lib "glut32" (label As PSTR, value As Long)
Declare Sub glutAddSubMenu Lib "glut32" (label As PSTR, submenu As Long)
Declare Sub glutChangeToMenuEntry Lib "glut32" (item As Long, label As PSTR, value As Long)
Declare Sub glutChangeToSubMenu Lib "glut32" (item As Long, label As PSTR, submenu As Long)
Declare Sub glutRemoveMenuItem Lib "glut32" (item As Long)
Declare Sub glutAttachMenu Lib "glut32" (button As Long)
Declare Sub glutDetachMenu Lib "glut32" (button As Long)
TypeDef LPDISPLAYFUNC = *Sub()
Declare Sub glutDisplayFunc Lib "glut32" (func As LPDISPLAYFUNC)
TypeDef LPRESHAPEFUNC = *Sub(width As Long, height As Long)
Declare Sub glutReshapeFunc Lib "glut32" (func As LPRESHAPEFUNC)
TypeDef LPKEYBOARDFUNC = *Sub(key As Byte, x As Long, y As Long)
Declare Sub glutKeyboardFunc Lib "glut32" (func As LPKEYBOARDFUNC)
TypeDef LPMOUSEFUNC = *Sub(button As Long, state As Long, x As Long, y As Long)
Declare Sub glutMouseFunc Lib "glut32" (func As LPMOUSEFUNC)
TypeDef LPMOTIONFUNC = *Sub(x As Long, y As Long)
Declare Sub glutMotionFunc Lib "glut32" (func As LPMOTIONFUNC)
TypeDef LPPASSIVEMOTIONFUNC = *Sub(x As Long, y As Long)
Declare Sub glutPassiveMotionFunc Lib "glut32" (func As LPPASSIVEMOTIONFUNC)
TypeDef LPENTRYFUNC = *Sub(state As Long)
Declare Sub glutEntryFunc Lib "glut32" (func As LPENTRYFUNC)
TypeDef LPVISIBILITYFUNC = *Sub(state As Long)
Declare Sub glutVisibilityFunc Lib "glut32" (func As LPVISIBILITYFUNC)
TypeDef LPIDLEFUNC = *Sub()
Declare Sub glutIdleFunc Lib "glut32" (func As LPIDLEFUNC)
TypeDef LPTIMERFUNC = *Sub(value As Long)
Declare Sub glutTimerFunc Lib "glut32" (millis As DWord, func As LPTIMERFUNC, value As Long)
TypeDef LPMENUSTATEFUNC = *Sub(state As Long)
Declare Sub glutMenuStateFunc Lib "glut32" (func As LPMENUSTATEFUNC)
TypeDef LPSPECIALFUNC = *Sub(int key, x As Long, y As Long)
Declare Sub glutSpecialFunc Lib "glut32" (func As LPSPECIALFUNC)
TypeDef LPSPACEBALLMOTIONFUNC = *Sub(x As Long, y As Long, int z)
Declare Sub glutSpaceballMotionFunc Lib "glut32" (func As LPSPACEBALLMOTIONFUNC)
TypeDef LPSPACEBALLROTATEFUNC = *Sub(x As Long, y As Long, int z)
Declare Sub glutSpaceballRotateFunc Lib "glut32" (func As LPSPACEBALLROTATEFUNC)
TypeDef LPSPACEBALLBUTTONFUNC = *Sub(button As Long, state As Long)
Declare Sub glutSpaceballButtonFunc Lib "glut32" (func As LPSPACEBALLBUTTONFUNC)
TypeDef LPBUTTONBOXFUNC = *Sub(button As Long, state As Long)
Declare Sub glutButtonBoxFunc Lib "glut32" (func As LPBUTTONBOXFUNC)
TypeDef LPDIALSFUNC = *Sub(dial As Long, value As Long)
Declare Sub glutDialsFunc Lib "glut32" (func As LPDIALSFUNC)
TypeDef LPTABLETMOTIONFUNC = *Sub(x As Long, y As Long)
Declare Sub glutTabletMotionFunc Lib "glut32" (func As LPTABLETMOTIONFUNC)
TypeDef LPTABLETBUTTONFUNC = *Sub(button As Long, state As Long, x As Long, y As Long)
Declare Sub glutTabletButtonFunc Lib "glut32" (func As LPTABLETBUTTONFUNC)
TypeDef LPMENUSTATUSFUNC = *Sub(int status, x As Long, y As Long)
Declare Sub glutMenuStatusFunc Lib "glut32" (func As LPMENUSTATUSFUNC)
TypeDef LPOVERLAYDISPLAYFUNC = *Sub()
Declare Sub glutOverlayDisplayFunc Lib "glut32" (func As LPOVERLAYDISPLAYFUNC)
TypeDef LPWINDOWSTATUSFUNC = *Sub(state As Long)
Declare Sub glutWindowStatusFunc Lib "glut32" (func As LPWINDOWSTATUSFUNC)
TypeDef LPKEYBOARDUPFUNC = *Sub(key As Byte, x As Long, y As Long)
Declare Sub glutKeyboardUpFunc Lib "glut32" (func As LPKEYBOARDUPFUNC)
TypeDef LPSPECIALUPFUNC = *Sub(int key, x As Long, y As Long)
Declare Sub glutSpecialUpFunc Lib "glut32" (func As LPSPECIALUPFUNC)
TypeDef LPJOYSTICKFUNC = *Sub(unsigned button As LongMask, x As Long, y As Long, int z)
Declare Sub glutJoystickFunc Lib "glut32" (func As LPJOYSTICKFUNC, pollInterval As Long)
Declare Sub glutSetColor Lib "glut32" (i As Long, red As GLfloat, green As GLfloat, blue As GLfloat)
Declare Function glutGetColor Lib "glut32" (ndx As Long, component As Long) As GLfloat
Declare Sub glutCopyColormap Lib "glut32" (win As Long)
Declare Function glutGet Lib "glut32" (type_ As GLenum) As Long
Declare Function glutDeviceGet Lib "glut32" (type_ As GLenum) As Long
Declare Function glutExtensionSupported Lib "glut32" (name As PSTR) As Long
Declare Function glutGetModifiers Lib "glut32" () As Long
Declare Function glutLayerGet Lib "glut32" (type_ As GLenum) As Long
Declare Sub glutBitmapCharacter Lib "glut32" (font As VoidPtr, character As Long)
Declare Function glutBitmapWidth Lib "glut32" (font As VoidPtr, character As Long) As Long
Declare Sub glutStrokeCharacter Lib "glut32" (font As VoidPtr, character As Long)
Declare Function glutStrokeWidth Lib "glut32" (font As VoidPtr, character As Long) As Long
Declare Function glutBitmapLength Lib "glut32" (font As VoidPtr, pstring As *Byte) As Long
Declare Function glutStrokeLength Lib "glut32" (font As VoidPtr, pstring As *Byte) As Long
Declare Sub glutWireSphere Lib "glut32" (radius As GLdouble, slices As GLint, stacks As GLint)
Declare Sub glutSolidSphere Lib "glut32" (radius As GLdouble, slices As GLint, stacks As GLint)
Declare Sub glutWireCone Lib "glut32" (base As GLdouble, height As GLdouble, slices As GLint, stacks As GLint)
Declare Sub glutSolidCone Lib "glut32" (base As GLdouble, height As GLdouble, slices As GLint, stacks As GLint)
Declare Sub glutWireCube Lib "glut32" (size As GLdouble)
Declare Sub glutSolidCube Lib "glut32" (size As GLdouble)
Declare Sub glutWireTorus Lib "glut32" (innerRadius As GLdouble, outerRadius As GLdouble, sides As GLint, rings As GLint)
Declare Sub glutSolidTorus Lib "glut32" (innerRadius As GLdouble, outerRadius As GLdouble, sides As GLint, rings As GLint)
Declare Sub glutWireDodecahedron Lib "glut32" ()
Declare Sub glutSolidDodecahedron Lib "glut32" ()
Declare Sub glutWireTeapot Lib "glut32" (size As GLdouble)
Declare Sub glutSolidTeapot Lib "glut32" (size As GLdouble)
Declare Sub glutWireOctahedron Lib "glut32" ()
Declare Sub glutSolidOctahedron Lib "glut32" ()
Declare Sub glutWireTetrahedron Lib "glut32" ()
Declare Sub glutSolidTetrahedron Lib "glut32" ()
Declare Sub glutWireIcosahedron Lib "glut32" ()
Declare Sub glutSolidIcosahedron Lib "glut32" ()
Declare Function glutVideoResizeGet Lib "glut32" (param As GLenum) As Long
Declare Sub glutSetupVideoResizing Lib "glut32" ()
Declare Sub glutStopVideoResizing Lib "glut32" ()
Declare Sub glutVideoResize Lib "glut32" (x As Long, y As Long, width As Long, height As Long)
Declare Sub glutVideoPan Lib "glut32" (x As Long, y As Long, width As Long, height As Long)
Declare Sub glutReportErrors Lib "glut32" ()

Const GLUT_KEY_REPEAT_OFF = 0
Const GLUT_KEY_REPEAT_ON = 1
Const GLUT_KEY_REPEAT_DEFAULT = 2

Const GLUT_JOYSTICK_BUTTON_A = 1
Const GLUT_JOYSTICK_BUTTON_B = 2
Const GLUT_JOYSTICK_BUTTON_C = 4
Const GLUT_JOYSTICK_BUTTON_D = 8

Declare Sub glutIgnoreKeyRepeat Lib "glut32" (ignore As Long)
Declare Sub glutSetKeyRepeat Lib "glut32" (repeatMode As Long)
Declare Sub glutForceJoystickFunc Lib "glut32" ()

Const GLUT_GAME_MODE_ACTIVE = 0
Const GLUT_GAME_MODE_POSSIBLE = 1
Const GLUT_GAME_MODE_WIDTH = 2
Const GLUT_GAME_MODE_HEIGHT = 3
Const GLUT_GAME_MODE_PIXEL_DEPTH = 4
Const GLUT_GAME_MODE_REFRESH_RATE = 5
Const GLUT_GAME_MODE_DISPLAY_CHANGED = 6

Declare Sub glutGameModeString Lib "glut32" (pstring As PSTR)
Declare Function glutEnterGameMode Lib "glut32" () As Long
Declare Sub glutLeaveGameMode Lib "glut32" ()
Declare Function glutGameModeGet Lib "glut32" (mode As GLenum) As Long
