PageRenderTime 32ms CodeModel.GetById 16ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

/support/ypsilon/glu.scm

http://github.com/dharmatech/abstracting
Scheme | 512 lines | 443 code | 39 blank | 30 comment | 0 complexity | f280f7a3607fdf7ad968b9c95574bb59 MD5 | raw file
  1
  2;; Original version for Gambit by David St-Hilaire
  3;;
  4;; Ported to Ypsilon by Ed Cavazos
  5
  6(library
  7
  8 (glu)
  9
 10 (export
 11
 12  GLU_EXT_object_space_tess
 13  GLU_EXT_nurbs_tessellator
 14  GLU_FALSE
 15  GLU_TRUE
 16  GLU_VERSION_1_1
 17  GLU_VERSION_1_2
 18  GLU_VERSION_1_3
 19  GLU_VERSION
 20  GLU_EXTENSIONS
 21  GLU_INVALID_ENUM
 22  GLU_INVALID_VALUE
 23  GLU_OUT_OF_MEMORY
 24  GLU_INCOMPATIBLE_GL_VERSION
 25  GLU_INVALID_OPERATION
 26  GLU_OUTLINE_POLYGON
 27  GLU_OUTLINE_PATCH
 28  GLU_NURBS_ERROR
 29  GLU_ERROR
 30  GLU_NURBS_BEGIN
 31  GLU_NURBS_BEGIN_EXT
 32  GLU_NURBS_VERTEX
 33  GLU_NURBS_VERTEX_EXT
 34  GLU_NURBS_NORMAL
 35  GLU_NURBS_NORMAL_EXT
 36  GLU_NURBS_COLOR
 37  GLU_NURBS_COLOR_EXT
 38  GLU_NURBS_TEXTURE_COORD
 39  GLU_NURBS_TEX_COORD_EXT
 40  GLU_NURBS_END
 41  GLU_NURBS_END_EXT
 42  GLU_NURBS_BEGIN_DATA
 43  GLU_NURBS_BEGIN_DATA_EXT
 44  GLU_NURBS_VERTEX_DATA
 45  GLU_NURBS_VERTEX_DATA_EXT
 46  GLU_NURBS_NORMAL_DATA
 47  GLU_NURBS_NORMAL_DATA_EXT
 48  GLU_NURBS_COLOR_DATA
 49  GLU_NURBS_COLOR_DATA_EXT
 50  GLU_NURBS_TEXTURE_COORD_DATA
 51  GLU_NURBS_TEX_COORD_DATA_EXT
 52  GLU_NURBS_END_DATA
 53  GLU_NURBS_END_DATA_EXT
 54  GLU_NURBS_ERROR1
 55  GLU_NURBS_ERROR2
 56  GLU_NURBS_ERROR3
 57  GLU_NURBS_ERROR4
 58  GLU_NURBS_ERROR5
 59  GLU_NURBS_ERROR6
 60  GLU_NURBS_ERROR7
 61  GLU_NURBS_ERROR8
 62  GLU_NURBS_ERROR9
 63  GLU_NURBS_ERROR10
 64  GLU_NURBS_ERROR11
 65  GLU_NURBS_ERROR12
 66  GLU_NURBS_ERROR13
 67  GLU_NURBS_ERROR14
 68  GLU_NURBS_ERROR15
 69  GLU_NURBS_ERROR16
 70  GLU_NURBS_ERROR17
 71  GLU_NURBS_ERROR18
 72  GLU_NURBS_ERROR19
 73  GLU_NURBS_ERROR20
 74  GLU_NURBS_ERROR21
 75  GLU_NURBS_ERROR22
 76  GLU_NURBS_ERROR23
 77  GLU_NURBS_ERROR24
 78  GLU_NURBS_ERROR25
 79  GLU_NURBS_ERROR26
 80  GLU_NURBS_ERROR27
 81  GLU_NURBS_ERROR28
 82  GLU_NURBS_ERROR29
 83  GLU_NURBS_ERROR30
 84  GLU_NURBS_ERROR31
 85  GLU_NURBS_ERROR32
 86  GLU_NURBS_ERROR33
 87  GLU_NURBS_ERROR34
 88  GLU_NURBS_ERROR35
 89  GLU_NURBS_ERROR36
 90  GLU_NURBS_ERROR37
 91  GLU_AUTO_LOAD_MATRIX
 92  GLU_CULLING
 93  GLU_SAMPLING_TOLERANCE
 94  GLU_DISPLAY_MODE
 95  GLU_PARAMETRIC_TOLERANCE
 96  GLU_SAMPLING_METHOD
 97  GLU_U_STEP
 98  GLU_V_STEP
 99  GLU_NURBS_MODE
100  GLU_NURBS_MODE_EXT
101  GLU_NURBS_TESSELLATOR
102  GLU_NURBS_TESSELLATOR_EXT
103  GLU_NURBS_RENDERER
104  GLU_NURBS_RENDERER_EXT
105  GLU_OBJECT_PARAMETRIC_ERROR
106  GLU_OBJECT_PARAMETRIC_ERROR_EXT
107  GLU_OBJECT_PATH_LENGTH
108  GLU_OBJECT_PATH_LENGTH_EXT
109  GLU_PATH_LENGTH
110  GLU_PARAMETRIC_ERROR
111  GLU_DOMAIN_DISTANCE
112  GLU_MAP1_TRIM_2
113  GLU_MAP1_TRIM_3
114  GLU_POINT
115  GLU_LINE
116  GLU_FILL
117  GLU_SILHOUETTE
118  GLU_SMOOTH
119  GLU_FLAT
120  GLU_NONE
121  GLU_OUTSIDE
122  GLU_INSIDE
123  GLU_TESS_BEGIN
124  GLU_BEGIN
125  GLU_TESS_VERTEX
126  GLU_VERTEX
127  GLU_TESS_END
128  GLU_END
129  GLU_TESS_ERROR
130  GLU_TESS_EDGE_FLAG
131  GLU_EDGE_FLAG
132  GLU_TESS_COMBINE
133  GLU_TESS_BEGIN_DATA
134  GLU_TESS_VERTEX_DATA
135  GLU_TESS_END_DATA
136  GLU_TESS_ERROR_DATA
137  GLU_TESS_EDGE_FLAG_DATA
138  GLU_TESS_COMBINE_DATA
139  GLU_CW
140  GLU_CCW
141  GLU_INTERIOR
142  GLU_EXTERIOR
143  GLU_UNKNOWN
144  GLU_TESS_WINDING_RULE
145  GLU_TESS_BOUNDARY_ONLY
146  GLU_TESS_TOLERANCE
147  GLU_TESS_ERROR1
148  GLU_TESS_ERROR2
149  GLU_TESS_ERROR3
150  GLU_TESS_ERROR4
151  GLU_TESS_ERROR5
152  GLU_TESS_ERROR6
153  GLU_TESS_ERROR7
154  GLU_TESS_ERROR8
155  GLU_TESS_MISSING_BEGIN_POLYGON
156  GLU_TESS_MISSING_BEGIN_CONTOUR
157  GLU_TESS_MISSING_END_POLYGON
158  GLU_TESS_MISSING_END_CONTOUR
159  GLU_TESS_COORD_TOO_LARGE
160  GLU_TESS_NEED_COMBINE_CALLBACK
161  GLU_TESS_WINDING_ODD
162  GLU_TESS_WINDING_NONZERO
163  GLU_TESS_WINDING_POSITIVE
164  GLU_TESS_WINDING_NEGATIVE
165  GLU_TESS_WINDING_ABS_GEQ_TWO
166  GLU_TESS_MAX_COORD
167
168  gluBeginCurve
169  gluBeginPolygon
170  gluBeginSurface
171  gluBeginTrim
172  gluBuild1DMipmapLevels
173  gluBuild1DMipmaps
174  gluBuild2DMipmapLevels
175  gluBuild2DMipmaps
176  gluBuild3DMipmapLevels
177  gluBuild3DMipmaps
178  gluCheckExtension
179  gluCylinder
180  gluDeleteNurbsRenderer
181  gluDeleteQuadric
182  gluDeleteTess
183  gluDisk
184  gluEndCurve
185  gluEndPolygon
186  gluEndSurface
187  gluEndTrim
188  gluErrorString
189  gluGetNurbsProperty
190  gluGetString
191  gluGetTessProperty
192  gluLoadSamplingMatrices
193  gluLookAt
194  gluNewNurbsRenderer
195  gluNewQuadric
196  gluNewTess
197  gluNextContour
198  ;; gluNurbsCallback
199  gluNurbsCallbackData
200  gluNurbsCallbackDataEXT
201  gluNurbsCurve
202  gluNurbsProperty
203  gluNurbsSurface
204  gluOrtho2D
205  gluPartialDisk
206  gluPerspective
207  gluPickMatrix
208  gluProject
209  gluPwlCurve
210  gluQuadricCallback
211  gluQuadricDrawStyle
212  gluQuadricNormals
213  gluQuadricOrientation
214  gluQuadricTexture
215  gluScaleImage
216  gluSphere
217  gluTessBeginContour
218  gluTessBeginPolygon
219  ;; gluTessCallback
220  gluTessEndContour
221  gluTessEndPolygon
222  gluTessNormal
223  gluTessProperty
224  gluTessVertex
225  gluUnProject
226  gluUnProject4)
227
228 (import (core)
229         (ypsilon ffi)
230         (ypsilon c-types)
231         )
232
233 (define libGLU (cond
234
235                 (on-darwin  (load-shared-object "OpenGL.framework/OpenGL"))
236                 ;; (on-windows (load-shared-object "opengl32.dll"))
237                 (on-linux   (load-shared-object "libGLU.so.1"))
238                 (on-freebsd (load-shared-object "libGLU.so"))
239                 (on-openbsd (load-shared-object "libGLU.so.7.3"))
240                 (else
241                  (assertion-violation #f "can not locate OpenGL library, unknown operating system"))))
242
243 (define GLU_EXT_object_space_tess 1)
244 (define GLU_EXT_nurbs_tessellator 1)
245
246                                        ;/* Boolean* /
247 (define GLU_FALSE 0)
248 (define GLU_TRUE 1)
249
250                                        ;/* Version* /
251 (define GLU_VERSION_1_1 1)
252 (define GLU_VERSION_1_2 1)
253 (define GLU_VERSION_1_3 1)
254
255                                        ;/* StringName* /
256 (define GLU_VERSION 100800)
257 (define GLU_EXTENSIONS 100801)
258
259                                        ;/* ErrorCode* /
260 (define GLU_INVALID_ENUM 100900)
261 (define GLU_INVALID_VALUE 100901)
262 (define GLU_OUT_OF_MEMORY 100902)
263 (define GLU_INCOMPATIBLE_GL_VERSION 100903)
264 (define GLU_INVALID_OPERATION 100904)
265
266 ;; /* NurbsDisplay* /
267 ;; /*      GLU_FILL* /
268 (define GLU_OUTLINE_POLYGON 100240)
269 (define GLU_OUTLINE_PATCH 100241)
270
271                                        ;/* NurbsCallback* /
272 (define GLU_NURBS_ERROR 100103)
273 (define GLU_ERROR 100103)
274 (define GLU_NURBS_BEGIN 100164)
275 (define GLU_NURBS_BEGIN_EXT 100164)
276 (define GLU_NURBS_VERTEX 100165)
277 (define GLU_NURBS_VERTEX_EXT 100165)
278 (define GLU_NURBS_NORMAL 100166)
279 (define GLU_NURBS_NORMAL_EXT 100166)
280 (define GLU_NURBS_COLOR 100167)
281 (define GLU_NURBS_COLOR_EXT 100167)
282 (define GLU_NURBS_TEXTURE_COORD 100168)
283 (define GLU_NURBS_TEX_COORD_EXT 100168)
284 (define GLU_NURBS_END 100169)
285 (define GLU_NURBS_END_EXT 100169)
286 (define GLU_NURBS_BEGIN_DATA 100170)
287 (define GLU_NURBS_BEGIN_DATA_EXT 100170)
288 (define GLU_NURBS_VERTEX_DATA 100171)
289 (define GLU_NURBS_VERTEX_DATA_EXT 100171)
290 (define GLU_NURBS_NORMAL_DATA 100172)
291 (define GLU_NURBS_NORMAL_DATA_EXT 100172)
292 (define GLU_NURBS_COLOR_DATA 100173)
293 (define GLU_NURBS_COLOR_DATA_EXT 100173)
294 (define GLU_NURBS_TEXTURE_COORD_DATA 100174)
295 (define GLU_NURBS_TEX_COORD_DATA_EXT 100174)
296 (define GLU_NURBS_END_DATA 100175)
297 (define GLU_NURBS_END_DATA_EXT 100175)
298
299                                        ;/* NurbsError* /
300 (define GLU_NURBS_ERROR1 100251)
301 (define GLU_NURBS_ERROR2 100252)
302 (define GLU_NURBS_ERROR3 100253)
303 (define GLU_NURBS_ERROR4 100254)
304 (define GLU_NURBS_ERROR5 100255)
305 (define GLU_NURBS_ERROR6 100256)
306 (define GLU_NURBS_ERROR7 100257)
307 (define GLU_NURBS_ERROR8 100258)
308 (define GLU_NURBS_ERROR9 100259)
309 (define GLU_NURBS_ERROR10 100260)
310 (define GLU_NURBS_ERROR11 100261)
311 (define GLU_NURBS_ERROR12 100262)
312 (define GLU_NURBS_ERROR13 100263)
313 (define GLU_NURBS_ERROR14 100264)
314 (define GLU_NURBS_ERROR15 100265)
315 (define GLU_NURBS_ERROR16 100266)
316 (define GLU_NURBS_ERROR17 100267)
317 (define GLU_NURBS_ERROR18 100268)
318 (define GLU_NURBS_ERROR19 100269)
319 (define GLU_NURBS_ERROR20 100270)
320 (define GLU_NURBS_ERROR21 100271)
321 (define GLU_NURBS_ERROR22 100272)
322 (define GLU_NURBS_ERROR23 100273)
323 (define GLU_NURBS_ERROR24 100274)
324 (define GLU_NURBS_ERROR25 100275)
325 (define GLU_NURBS_ERROR26 100276)
326 (define GLU_NURBS_ERROR27 100277)
327 (define GLU_NURBS_ERROR28 100278)
328 (define GLU_NURBS_ERROR29 100279)
329 (define GLU_NURBS_ERROR30 100280)
330 (define GLU_NURBS_ERROR31 100281)
331 (define GLU_NURBS_ERROR32 100282)
332 (define GLU_NURBS_ERROR33 100283)
333 (define GLU_NURBS_ERROR34 100284)
334 (define GLU_NURBS_ERROR35 100285)
335 (define GLU_NURBS_ERROR36 100286)
336 (define GLU_NURBS_ERROR37 100287)
337
338                                        ;/* NurbsProperty* /
339 (define GLU_AUTO_LOAD_MATRIX 100200)
340 (define GLU_CULLING 100201)
341 (define GLU_SAMPLING_TOLERANCE 100203)
342 (define GLU_DISPLAY_MODE 100204)
343 (define GLU_PARAMETRIC_TOLERANCE 100202)
344 (define GLU_SAMPLING_METHOD 100205)
345 (define GLU_U_STEP 100206)
346 (define GLU_V_STEP 100207)
347 (define GLU_NURBS_MODE 100160)
348 (define GLU_NURBS_MODE_EXT 100160)
349 (define GLU_NURBS_TESSELLATOR 100161)
350 (define GLU_NURBS_TESSELLATOR_EXT 100161)
351 (define GLU_NURBS_RENDERER 100162)
352 (define GLU_NURBS_RENDERER_EXT 100162)
353
354                                        ;/* NurbsSampling* /
355 (define GLU_OBJECT_PARAMETRIC_ERROR 100208)
356 (define GLU_OBJECT_PARAMETRIC_ERROR_EXT 100208)
357 (define GLU_OBJECT_PATH_LENGTH 100209)
358 (define GLU_OBJECT_PATH_LENGTH_EXT 100209)
359 (define GLU_PATH_LENGTH 100215)
360 (define GLU_PARAMETRIC_ERROR 100216)
361 (define GLU_DOMAIN_DISTANCE 100217)
362
363                                        ;/* NurbsTrim* /
364 (define GLU_MAP1_TRIM_2 100210)
365 (define GLU_MAP1_TRIM_3 100211)
366
367                                        ;/* QuadricDrawStyle* /
368 (define GLU_POINT 100010)
369 (define GLU_LINE 100011)
370 (define GLU_FILL 100012)
371 (define GLU_SILHOUETTE 100013)
372
373 ;; /* QuadricCallback* /
374 ;; /*      GLU_ERROR* /
375
376                                        ;/* QuadricNormal* /
377 (define GLU_SMOOTH 100000)
378 (define GLU_FLAT 100001)
379 (define GLU_NONE 100002)
380
381                                        ;/* QuadricOrientation* /
382 (define GLU_OUTSIDE 100020)
383 (define GLU_INSIDE 100021)
384
385                                        ;/* TessCallback* /
386 (define GLU_TESS_BEGIN 100100)
387 (define GLU_BEGIN 100100)
388 (define GLU_TESS_VERTEX 100101)
389 (define GLU_VERTEX 100101)
390 (define GLU_TESS_END 100102)
391 (define GLU_END 100102)
392 (define GLU_TESS_ERROR 100103)
393 (define GLU_TESS_EDGE_FLAG 100104)
394 (define GLU_EDGE_FLAG 100104)
395 (define GLU_TESS_COMBINE 100105)
396 (define GLU_TESS_BEGIN_DATA 100106)
397 (define GLU_TESS_VERTEX_DATA 100107)
398 (define GLU_TESS_END_DATA 100108)
399 (define GLU_TESS_ERROR_DATA 100109)
400 (define GLU_TESS_EDGE_FLAG_DATA 100110)
401 (define GLU_TESS_COMBINE_DATA 100111)
402
403                                        ;/* TessContour* /
404 (define GLU_CW 100120)
405 (define GLU_CCW 100121)
406 (define GLU_INTERIOR 100122)
407 (define GLU_EXTERIOR 100123)
408 (define GLU_UNKNOWN 100124)
409
410                                        ;/* TessProperty* /
411 (define GLU_TESS_WINDING_RULE 100140)
412 (define GLU_TESS_BOUNDARY_ONLY 100141)
413 (define GLU_TESS_TOLERANCE 100142)
414
415                                        ;/* TessError* /
416 (define GLU_TESS_ERROR1 100151)
417 (define GLU_TESS_ERROR2 100152)
418 (define GLU_TESS_ERROR3 100153)
419 (define GLU_TESS_ERROR4 100154)
420 (define GLU_TESS_ERROR5 100155)
421 (define GLU_TESS_ERROR6 100156)
422 (define GLU_TESS_ERROR7 100157)
423 (define GLU_TESS_ERROR8 100158)
424 (define GLU_TESS_MISSING_BEGIN_POLYGON 100151)
425 (define GLU_TESS_MISSING_BEGIN_CONTOUR 100152)
426 (define GLU_TESS_MISSING_END_POLYGON 100153)
427 (define GLU_TESS_MISSING_END_CONTOUR 100154)
428 (define GLU_TESS_COORD_TOO_LARGE 100155)
429 (define GLU_TESS_NEED_COMBINE_CALLBACK 100156)
430
431                                        ;/* TessWinding* /
432 (define GLU_TESS_WINDING_ODD 100130)
433 (define GLU_TESS_WINDING_NONZERO 100131)
434 (define GLU_TESS_WINDING_POSITIVE 100132)
435 (define GLU_TESS_WINDING_NEGATIVE 100133)
436 (define GLU_TESS_WINDING_ABS_GEQ_TWO 100134)
437
438
439 (define GLU_TESS_MAX_COORD 1e150)
440
441 (define-syntax define-function
442   (syntax-rules ()
443     ((_ ret name args)
444      (define name (c-function libGLU "GLU library" ret __stdcall name args)))))
445 
446 (define-function void gluBeginCurve (void*))
447 (define-function void gluBeginPolygon (void*))
448 (define-function void gluBeginSurface (void*))
449 (define-function void gluBeginTrim (void*))
450 (define-function int gluBuild1DMipmapLevels (int int int int int int int int void*))
451 (define-function int gluBuild1DMipmaps (int int int int int void*))
452 (define-function int gluBuild2DMipmapLevels (int int int int int int int int int void*))
453 (define-function int gluBuild2DMipmaps (int int int int int int void*))
454 (define-function int gluBuild3DMipmapLevels (int int int int int int int int int int void*))
455 (define-function int gluBuild3DMipmaps (int int int int int int int void*))
456 (define-function int gluCheckExtension (void* void*))
457 (define-function void gluCylinder (void* double double double int int))
458 (define-function void gluDeleteNurbsRenderer (void*))
459 (define-function void gluDeleteQuadric (void*))
460 (define-function void gluDeleteTess (void*))
461 (define-function void gluDisk (void* double double int int))
462 (define-function void gluEndCurve (void*))
463 (define-function void gluEndPolygon (void*))
464 (define-function void gluEndSurface (void*))
465 (define-function void gluEndTrim (void*))
466 (define-function void* gluErrorString (int))
467 (define-function void gluGetNurbsProperty (void* int void*))
468 (define-function void* gluGetString (int))
469 (define-function void gluGetTessProperty (void* int void*))
470 (define-function void gluLoadSamplingMatrices (void* void* void* void*))
471 (define-function void gluLookAt (double double double double double double double double double))
472 (define-function void* gluNewNurbsRenderer ())
473 (define-function void* gluNewQuadric ())
474 (define-function void* gluNewTess ())
475 (define-function void gluNextContour (void* int))
476 ;; (define-function void gluNurbsCallback (void* int _GLUfuncptr))
477 (define-function void gluNurbsCallbackData (void* void*))
478 (define-function void gluNurbsCallbackDataEXT (void* void*))
479 (define-function void gluNurbsCurve (void* int void* int void* int int))
480 (define-function void gluNurbsProperty (void* int float))
481 (define-function void gluNurbsSurface (void* int void* int void* int int void* int int int))
482 (define-function void gluOrtho2D (double double double double))
483 (define-function void gluPartialDisk (void* double double int int double double))
484 (define-function void gluPerspective (double double double double))
485 (define-function void gluPickMatrix (double double double double void*))
486 (define-function int gluProject (double double double void* void* void* void* void* void*))
487 (define-function void gluPwlCurve (void* int void* int int))
488
489 ;; (define-function void gluQuadricCallback (void* int _GLUfuncptr))
490
491 (define-function void gluQuadricCallback (void* int (c-callback void (int))))
492 
493 (define-function void gluQuadricDrawStyle (void* int))
494 (define-function void gluQuadricNormals (void* int))
495 (define-function void gluQuadricOrientation (void* int))
496 (define-function void gluQuadricTexture (void* int))
497 (define-function int gluScaleImage (int int int int void* int int int void*))
498 (define-function void gluSphere (void* double int int))
499 (define-function void gluTessBeginContour (void*))
500 (define-function void gluTessBeginPolygon (void* void*))
501
502 ;; (define-function void gluTessCallback (void* int _GLUfuncptr))
503
504 (define-function void gluTessEndContour (void*))
505 (define-function void gluTessEndPolygon (void*))
506 (define-function void gluTessNormal (void* double double double))
507 (define-function void gluTessProperty (void* int double))
508 (define-function void gluTessVertex (void* void* void*))
509 (define-function int gluUnProject (double double double void* void* void* void* void* void*))
510 (define-function int gluUnProject4 (double double double double void* void* void* double double void* void* void* void*))
511
512 )