'
' GLU definitions based on SGI GLU - their license below.
'
' Ported to BaCon INCLUDE file by Peter van Eerten - GPL.
'
' Version 1.0: Initial release
' Version 1.1: Added heuristic library search
' Version 1.2: Compatibility with MacOSX
' Version 1.3: Compatibility with Cygwin/X
' Version 1.4: Updated for BaCon 3.x
'
' glu.h
'
' SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
' Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
'
' Permission is hereby granted, free of charge, to any person obtaining a
' copy of this software and associated documentation files (the "Software"),
' to deal in the Software without restriction, including without limitation
' the rights to use, copy, modify, merge, publish, distribute, sublicense,
' and/or sell copies of the Software, and to permit persons to whom the
' Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice including the dates of first publication and
' either this permission notice or a reference to
' http://oss.sgi.com/projects/FreeB/
' shall be included in all copies or substantial portions of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
' OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
' SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
' WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
' OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
' SOFTWARE.
'
' Except as contained in this notice, the name of Silicon Graphics, Inc.
' shall not be used in advertising or otherwise to promote the sale, use or
' other dealings in this Software without prior written authorization from
' Silicon Graphics, Inc.
'
CATCH GOTO glu_handle_error

IF INSTR(OS$, "Darwin") THEN
    glu_LIB$="/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib"
ELIF INSTR(OS$, "CYGWIN") THEN
    glu_LIB$ = "cygGLU-1.dll"
ELSE
    glu_LIB$ = "libGLU.so"
END IF

glu_seq = -1

LABEL glu_import_retry
    INCR glu_seq
    glu_retry = FALSE
    IMPORT "gluNewTess(void)" FROM glu_LIB$ TYPE long
    IF glu_retry THEN GOTO glu_import_retry

GOTO glu_continue

LABEL glu_handle_error
    IF glu_seq IS 0 THEN glu_LIB$ = "libGLU.so.0"
    ELSE glu_LIB$ = CONCAT$(LEFT$(glu_LIB$, INSTRREV(glu_LIB$, ".")), STR$(glu_seq))
    IF glu_seq < 10 THEN
        glu_retry = TRUE
    ELSE
        PRINT "No GLU library found!"
        END
    END IF
    RESUME

LABEL glu_continue

CONST GLU_EXT_object_space_tess = 1
CONST GLU_EXT_nurbs_tessellator = 1
CONST GLU_FALSE = 0
CONST GLU_TRUE = 1
CONST GLU_VERSION_1_1 = 1
CONST GLU_VERSION_1_2 = 1
CONST GLU_VERSION_1_3 = 1
CONST GLU_VERSION = 100800
CONST GLU_EXTENSIONS = 100801
CONST GLU_INVALID_ENUM = 100900
CONST GLU_INVALID_VALUE = 100901
CONST GLU_OUT_OF_MEMORY = 100902
CONST GLU_INCOMPATIBLE_GL_VERSION = 100903
CONST GLU_INVALID_OPERATION = 100904
CONST GLU_OUTLINE_POLYGON = 100240
CONST GLU_OUTLINE_PATCH = 100241
CONST GLU_NURBS_ERROR = 100103
CONST GLU_ERROR = 100103
CONST GLU_NURBS_BEGIN = 100164
CONST GLU_NURBS_BEGIN_EXT = 100164
CONST GLU_NURBS_VERTEX = 100165
CONST GLU_NURBS_VERTEX_EXT = 100165
CONST GLU_NURBS_NORMAL = 100166
CONST GLU_NURBS_NORMAL_EXT = 100166
CONST GLU_NURBS_COLOR = 100167
CONST GLU_NURBS_COLOR_EXT = 100167
CONST GLU_NURBS_TEXTURE_COORD = 100168
CONST GLU_NURBS_TEX_COORD_EXT = 100168
CONST GLU_NURBS_END = 100169
CONST GLU_NURBS_END_EXT = 100169
CONST GLU_NURBS_BEGIN_DATA = 100170
CONST GLU_NURBS_BEGIN_DATA_EXT = 100170
CONST GLU_NURBS_VERTEX_DATA = 100171
CONST GLU_NURBS_VERTEX_DATA_EXT = 100171
CONST GLU_NURBS_NORMAL_DATA = 100172
CONST GLU_NURBS_NORMAL_DATA_EXT = 100172
CONST GLU_NURBS_COLOR_DATA = 100173
CONST GLU_NURBS_COLOR_DATA_EXT = 100173
CONST GLU_NURBS_TEXTURE_COORD_DATA = 100174
CONST GLU_NURBS_TEX_COORD_DATA_EXT = 100174
CONST GLU_NURBS_END_DATA = 100175
CONST GLU_NURBS_END_DATA_EXT = 100175
CONST GLU_NURBS_ERROR1 = 100251
CONST GLU_NURBS_ERROR2 = 100252
CONST GLU_NURBS_ERROR3 = 100253
CONST GLU_NURBS_ERROR4 = 100254
CONST GLU_NURBS_ERROR5 = 100255
CONST GLU_NURBS_ERROR6 = 100256
CONST GLU_NURBS_ERROR7 = 100257
CONST GLU_NURBS_ERROR8 = 100258
CONST GLU_NURBS_ERROR9 = 100259
CONST GLU_NURBS_ERROR10 = 100260
CONST GLU_NURBS_ERROR11 = 100261
CONST GLU_NURBS_ERROR12 = 100262
CONST GLU_NURBS_ERROR13 = 100263
CONST GLU_NURBS_ERROR14 = 100264
CONST GLU_NURBS_ERROR15 = 100265
CONST GLU_NURBS_ERROR16 = 100266
CONST GLU_NURBS_ERROR17 = 100267
CONST GLU_NURBS_ERROR18 = 100268
CONST GLU_NURBS_ERROR19 = 100269
CONST GLU_NURBS_ERROR20 = 100270
CONST GLU_NURBS_ERROR21 = 100271
CONST GLU_NURBS_ERROR22 = 100272
CONST GLU_NURBS_ERROR23 = 100273
CONST GLU_NURBS_ERROR24 = 100274
CONST GLU_NURBS_ERROR25 = 100275
CONST GLU_NURBS_ERROR26 = 100276
CONST GLU_NURBS_ERROR27 = 100277
CONST GLU_NURBS_ERROR28 = 100278
CONST GLU_NURBS_ERROR29 = 100279
CONST GLU_NURBS_ERROR30 = 100280
CONST GLU_NURBS_ERROR31 = 100281
CONST GLU_NURBS_ERROR32 = 100282
CONST GLU_NURBS_ERROR33 = 100283
CONST GLU_NURBS_ERROR34 = 100284
CONST GLU_NURBS_ERROR35 = 100285
CONST GLU_NURBS_ERROR36 = 100286
CONST GLU_NURBS_ERROR37 = 100287
CONST GLU_AUTO_LOAD_MATRIX = 100200
CONST GLU_CULLING = 100201
CONST GLU_SAMPLING_TOLERANCE = 100203
CONST GLU_DISPLAY_MODE = 100204
CONST GLU_PARAMETRIC_TOLERANCE = 100202
CONST GLU_SAMPLING_METHOD = 100205
CONST GLU_U_STEP = 100206
CONST GLU_V_STEP = 100207
CONST GLU_NURBS_MODE = 100160
CONST GLU_NURBS_MODE_EXT = 100160
CONST GLU_NURBS_TESSELLATOR = 100161
CONST GLU_NURBS_TESSELLATOR_EXT = 100161
CONST GLU_NURBS_RENDERER = 100162
CONST GLU_NURBS_RENDERER_EXT = 100162
CONST GLU_OBJECT_PARAMETRIC_ERROR = 100208
CONST GLU_OBJECT_PARAMETRIC_ERROR_EXT = 100208
CONST GLU_OBJECT_PATH_LENGTH = 100209
CONST GLU_OBJECT_PATH_LENGTH_EXT = 100209
CONST GLU_PATH_LENGTH = 100215
CONST GLU_PARAMETRIC_ERROR = 100216
CONST GLU_DOMAIN_DISTANCE = 100217
CONST GLU_MAP1_TRIM_2 = 100210
CONST GLU_MAP1_TRIM_3 = 100211
CONST GLU_POINT = 100010
CONST GLU_LINE = 100011
CONST GLU_FILL = 100012
CONST GLU_SILHOUETTE = 100013
CONST GLU_SMOOTH = 100000
CONST GLU_FLAT = 100001
CONST GLU_NONE = 100002
CONST GLU_OUTSIDE = 100020
CONST GLU_INSIDE = 100021
CONST GLU_TESS_BEGIN = 100100
CONST GLU_BEGIN = 100100
CONST GLU_TESS_VERTEX = 100101
CONST GLU_VERTEX = 100101
CONST GLU_TESS_END = 100102
CONST GLU_END = 100102
CONST GLU_TESS_ERROR = 100103
CONST GLU_TESS_EDGE_FLAG = 100104
CONST GLU_EDGE_FLAG = 100104
CONST GLU_TESS_COMBINE = 100105
CONST GLU_TESS_BEGIN_DATA = 100106
CONST GLU_TESS_VERTEX_DATA = 100107
CONST GLU_TESS_END_DATA = 100108
CONST GLU_TESS_ERROR_DATA = 100109
CONST GLU_TESS_EDGE_FLAG_DATA = 100110
CONST GLU_TESS_COMBINE_DATA = 100111
CONST GLU_CW = 100120
CONST GLU_CCW = 100121
CONST GLU_INTERIOR = 100122
CONST GLU_EXTERIOR = 100123
CONST GLU_UNKNOWN = 100124
CONST GLU_TESS_WINDING_RULE = 100140
CONST GLU_TESS_BOUNDARY_ONLY = 100141
CONST GLU_TESS_TOLERANCE = 100142
CONST GLU_TESS_ERROR1 = 100151
CONST GLU_TESS_ERROR2 = 100152
CONST GLU_TESS_ERROR3 = 100153
CONST GLU_TESS_ERROR4 = 100154
CONST GLU_TESS_ERROR5 = 100155
CONST GLU_TESS_ERROR6 = 100156
CONST GLU_TESS_ERROR7 = 100157
CONST GLU_TESS_ERROR8 = 100158
CONST GLU_TESS_MISSING_BEGIN_POLYGON = 100151
CONST GLU_TESS_MISSING_BEGIN_CONTOUR = 100152
CONST GLU_TESS_MISSING_END_POLYGON = 100153
CONST GLU_TESS_MISSING_END_CONTOUR = 100154
CONST GLU_TESS_COORD_TOO_LARGE = 100155
CONST GLU_TESS_NEED_COMBINE_CALLBACK = 100156
CONST GLU_TESS_WINDING_ODD = 100130
CONST GLU_TESS_WINDING_NONZERO = 100131
CONST GLU_TESS_WINDING_POSITIVE = 100132
CONST GLU_TESS_WINDING_NEGATIVE = 100133
CONST GLU_TESS_WINDING_ABS_GEQ_TWO = 100134
CONST GLU_TESS_MAX_COORD = 1.0e150

IMPORT "gluBeginCurve(long)" FROM glu_LIB$ TYPE void
IMPORT "gluBeginPolygon(long)" FROM glu_LIB$ TYPE void
IMPORT "gluBeginSurface(long)" FROM glu_LIB$ TYPE void
IMPORT "gluBeginTrim(long)" FROM glu_LIB$ TYPE void
IMPORT "gluBuild1DMipmapLevels(int,int,int,int,int,int,int,int,long)" FROM glu_LIB$ TYPE int
IMPORT "gluBuild1DMipmaps(int,int,int,int,int,long)" FROM glu_LIB$ TYPE int
IMPORT "gluBuild2DMipmapLevels(int,int,int,int,int,int,int,int,int,long)" FROM glu_LIB$ TYPE int
IMPORT "gluBuild2DMipmaps(int,int,int,int,int,int,long)" FROM glu_LIB$ TYPE int
IMPORT "gluBuild3DMipmapLevels(int,int,int,int,int,int,int,int,int,int,long)" FROM glu_LIB$ TYPE int
IMPORT "gluBuild3DMipmaps(int,int,int,int,int,int,int,long)" FROM glu_LIB$ TYPE int
IMPORT "gluCheckExtension(char*,char*)" FROM glu_LIB$ TYPE int
IMPORT "gluCylinder(long,double,double,double,int,int)" FROM glu_LIB$ TYPE void
IMPORT "gluDeleteNurbsRenderer(long)" FROM glu_LIB$ TYPE void
IMPORT "gluDeleteQuadric(long)" FROM glu_LIB$ TYPE void
IMPORT "gluDeleteTess(long)" FROM glu_LIB$ TYPE void
IMPORT "gluDisk(long,double,double,int,int)" FROM glu_LIB$ TYPE void
IMPORT "gluEndCurve(long)" FROM glu_LIB$ TYPE void
IMPORT "gluEndPolygon(long)" FROM glu_LIB$ TYPE void
IMPORT "gluEndSurface(long)" FROM glu_LIB$ TYPE void
IMPORT "gluEndTrim(long)" FROM glu_LIB$ TYPE void
IMPORT "gluErrorString(int)" FROM glu_LIB$ TYPE char*
IMPORT "gluGetNurbsProperty(long,int,long)" FROM glu_LIB$ TYPE void
IMPORT "gluGetString(int)" FROM glu_LIB$ TYPE char*
IMPORT "gluGetTessProperty(long,int,long)" FROM glu_LIB$ TYPE void
IMPORT "gluLoadSamplingMatrices(long,long,long,long)" FROM glu_LIB$ TYPE void
IMPORT "gluLookAt(double,double,double,double,double,double,double,double,double)" FROM glu_LIB$ TYPE void
IMPORT "gluNewNurbsRenderer(void)" FROM glu_LIB$ TYPE long
IMPORT "gluNewQuadric(void)" FROM glu_LIB$ TYPE long
IMPORT "gluNextContour(long,int)" FROM glu_LIB$ TYPE void
IMPORT "gluNurbsCallback(long,int,long)" FROM glu_LIB$ TYPE void
IMPORT "gluNurbsCallbackData(long,long)" FROM glu_LIB$ TYPE void
IMPORT "gluNurbsCallbackDataEXT(long,long)" FROM glu_LIB$ TYPE void
IMPORT "gluNurbsCurve(long,int,long,int,long,int,int)" FROM glu_LIB$ TYPE void
IMPORT "gluNurbsProperty(long,int,float)" FROM glu_LIB$ TYPE void
IMPORT "gluNurbsSurface(long,int,long,int,long,int,int,long,int,int,int)" FROM glu_LIB$ TYPE void
IMPORT "gluOrtho2D(double,double,double,double)" FROM glu_LIB$ TYPE void
IMPORT "gluPartialDisk(long,double,double,int,int,double,double)" FROM glu_LIB$ TYPE void
IMPORT "gluPerspective(double,double,double,double)" FROM glu_LIB$ TYPE void
IMPORT "gluPickMatrix(double,double,double,double,long)" FROM glu_LIB$ TYPE void
IMPORT "gluProject(double,double,double,long,long,long,long,long,long)" FROM glu_LIB$ TYPE int
IMPORT "gluPwlCurve(long,int,long,int,int)" FROM glu_LIB$ TYPE void
IMPORT "gluQuadricCallback(long,int,long)" FROM glu_LIB$ TYPE void
IMPORT "gluQuadricDrawStyle(long,int)" FROM glu_LIB$ TYPE void
IMPORT "gluQuadricNormals(long,int)" FROM glu_LIB$ TYPE void
IMPORT "gluQuadricOrientation(long,int)" FROM glu_LIB$ TYPE void
IMPORT "gluQuadricTexture(long,int)" FROM glu_LIB$ TYPE void
IMPORT "gluScaleImage(int,int,int,int,long,int,int,int,long)" FROM glu_LIB$ TYPE int
IMPORT "gluSphere(long,double,int,int)" FROM glu_LIB$ TYPE void
IMPORT "gluTessBeginContour(long)" FROM glu_LIB$ TYPE void
IMPORT "gluTessBeginPolygon(long,long)" FROM glu_LIB$ TYPE void
IMPORT "gluTessCallback(long,int,long)" FROM glu_LIB$ TYPE void
IMPORT "gluTessEndContour(long)" FROM glu_LIB$ TYPE void
IMPORT "gluTessEndPolygon(long)" FROM glu_LIB$ TYPE void
IMPORT "gluTessNormal(long,double,double,double)" FROM glu_LIB$ TYPE void
IMPORT "gluTessProperty(long,int,double)" FROM glu_LIB$ TYPE void
IMPORT "gluTessVertex(long,long,long)" FROM glu_LIB$ TYPE void
IMPORT "gluUnProject(double,double,double,long,long,long,long,long,long)" FROM glu_LIB$ TYPE int
IMPORT "gluUnProject4(double,double,double,double,long,long,long,double,double,long,long,long,long)" FROM glu_LIB$ TYPE int

CATCH RESET