(define (gl:scale kx ky kz)
(guarantee-current 'GL:SCALE)
- (guarantee-flonum kx 'GL:SCALE)
- (guarantee-flonum ky 'GL:SCALE)
- (guarantee-flonum kz 'GL:SCALE)
+ (guarantee flo:flonum? kx 'GL:SCALE)
+ (guarantee flo:flonum? ky 'GL:SCALE)
+ (guarantee flo:flonum? kz 'GL:SCALE)
(C-call "glScaled" kx ky kz))
(define (gl:begin mode)
(define (gl:call-list lst)
(guarantee-current 'GL:CALL-LIST)
- (guarantee-integer lst 'GL:CALL-LIST)
+ (guarantee integer? lst 'GL:CALL-LIST)
(C-call "glCallList" lst))
(define (gl:draw-buffer buffer)
(define (gl:frustum left right bottom top near-val far-val)
(guarantee-current 'GL:DRAW-BUFFER)
- (guarantee-flonum left 'GL:DRAW-BUFFER)
- (guarantee-flonum right 'GL:DRAW-BUFFER)
- (guarantee-flonum bottom 'GL:DRAW-BUFFER)
- (guarantee-flonum top 'GL:DRAW-BUFFER)
- (guarantee-flonum near-val 'GL:DRAW-BUFFER)
- (guarantee-flonum far-val 'GL:DRAW-BUFFER)
+ (guarantee flo:flonum? left 'GL:DRAW-BUFFER)
+ (guarantee flo:flonum? right 'GL:DRAW-BUFFER)
+ (guarantee flo:flonum? bottom 'GL:DRAW-BUFFER)
+ (guarantee flo:flonum? top 'GL:DRAW-BUFFER)
+ (guarantee flo:flonum? near-val 'GL:DRAW-BUFFER)
+ (guarantee flo:flonum? far-val 'GL:DRAW-BUFFER)
(C-call "glFrustum" left right bottom top near-val far-val))
(define (gl:gen-lists range)
(guarantee-current 'GL:GEN-LISTS)
- (guarantee-integer range 'GL:GEN-LISTS)
+ (guarantee integer? range 'GL:GEN-LISTS)
(C-call "glGenLists" range))
(define (gl:light light param values)
(define (gl:light-model param value)
(case param
((LOCAL-VIEWER)
- (guarantee-flonum value 'gl:light-model)
+ (guarantee flo:flonum? value 'gl:light-model)
(C-call "glLightModelf" (C-enum "GL_LIGHT_MODEL_LOCAL_VIEWER") value))
((COLOR-CONTROL)
(C-call "glLightModeli" (C-enum "GL_LIGHT_MODEL_COLOR_CONTROL")
((SINGLE-COLOR) (C-enum "GL_SINGLE_COLOR"))
(else (error "gl:light-model: Unknown color-control:" value)))))
((TWO-SIDE)
- (guarantee-flonum value 'gl:light-model)
+ (guarantee flo:flonum? value 'gl:light-model)
(C-call "glLightModelf" (C-enum "GL_LIGHT_MODEL_TWO_SIDE") value))
((AMBIENT)
(guarantee-4d value 'gl:light-model)
(guarantee-4d values 'GL:MATERIAL)
(C-enum "GL_EMISSION"))
((SHININESS)
- (guarantee-flonum values 'GL:MATERIAL)
+ (guarantee flo:flonum? values 'GL:MATERIAL)
(C-enum "GL_SHININESS"))
((AMBIENT-AND-DIFFUSE)
(guarantee-4d values 'GL:MATERIAL)
(define (gl:new-list lst mode)
(guarantee-current 'GL:NEW-LIST)
- (guarantee-integer lst 'GL:NEW-LIST)
+ (guarantee integer? lst 'GL:NEW-LIST)
(C-call "glNewList"
lst
(case mode
(define (gl:delete-lists lst range)
(guarantee-current 'GL:DELETE-LISTS)
- (guarantee-integer lst 'GL:DELETE-LISTS)
- (guarantee-integer range 'GL:DELETE-LISTS)
+ (guarantee integer? lst 'GL:DELETE-LISTS)
+ (guarantee integer? range 'GL:DELETE-LISTS)
(C-call "glDeleteLists" lst range))
(define (gl:normal 3d)
(define (gl:rotate angle x y z)
(guarantee-current 'GL:ROTATE)
- (guarantee-flonum x 'GL:ROTATE)
- (guarantee-flonum y 'GL:ROTATE)
- (guarantee-flonum z 'GL:ROTATE)
+ (guarantee flo:flonum? x 'GL:ROTATE)
+ (guarantee flo:flonum? y 'GL:ROTATE)
+ (guarantee flo:flonum? z 'GL:ROTATE)
(C-call "glRotated" angle x y z))
(define (gl:translate x y z)
(guarantee-current 'GL:TRANSLATE)
- (guarantee-flonum x 'GL:TRANSLATE)
- (guarantee-flonum y 'GL:TRANSLATE)
- (guarantee-flonum z 'GL:TRANSLATE)
+ (guarantee flo:flonum? x 'GL:TRANSLATE)
+ (guarantee flo:flonum? y 'GL:TRANSLATE)
+ (guarantee flo:flonum? z 'GL:TRANSLATE)
(C-call "glTranslated" x y z))
(define (gl:viewport x y width height)
(guarantee-current 'GL:VIEWPORT)
- (guarantee-integer x 'GL:VIEWPORT)
- (guarantee-integer y 'GL:VIEWPORT)
- (guarantee-integer width 'GL:VIEWPORT)
- (guarantee-integer height 'GL:VIEWPORT)
+ (guarantee integer? x 'GL:VIEWPORT)
+ (guarantee integer? y 'GL:VIEWPORT)
+ (guarantee integer? width 'GL:VIEWPORT)
+ (guarantee integer? height 'GL:VIEWPORT)
(C-call "glViewport" x y width height))
(define (gl:flush)
(if (not (param:gl-context-current?))
(error "The GL library has no context:" operator)))
-(define (guarantee-flonum object operator)
- (if (not (flo:flonum? object))
- (error:wrong-type-argument object "a flonum" operator)))
-
(define (guarantee-color object operator)
(if (not (and (flo:flonum? object)
(fix:= 4 (flo:vector-length object))))
(cadr entry)
(error "Display not specified."))
0)))
- (dpy (C-call "XOpenDisplay" (make-alien '|Display|) dpyName)))
+ (dpy (C-call "XOpenDisplay" (make-alien '|Display|)
+ (if (string? dpyName) (string->utf8 dpyName) 0))))
(if (alien-null? dpy)
- (error "couldn't open display:" (if (zero? dpyName) "" dpyName)))
+ (error "couldn't open display:" (if (string? dpyName) dpyName "")))
(if fullscreen
(let ((scrnum (C-call "DefaultScreen" dpy)))
(define c-poke-int (make-primitive-procedure 'C-POKE-INT 3))
(define (get-string symbol)
- (c-peek-cstring
- (case symbol
- ((renderer)
- (C-call "glGetString" (make-alien 'char) (C-enum "GL_RENDERER")))
- ((version)
- (C-call "glGetString" (make-alien 'char) (C-enum "GL_VERSION")))
- ((vendor)
- (C-call "glGetString" (make-alien 'char) (C-enum "GL_VENDOR")))
- ((extensions)
- (C-call "glGetString" (make-alien 'char) (C-enum "GL_EXTENSIONS")))
- (else
- (error "Unknown gl String:" symbol)))))
+ (utf8->string
+ (c-peek-cstring
+ (case symbol
+ ((renderer)
+ (C-call "glGetString" (make-alien 'char) (C-enum "GL_RENDERER")))
+ ((version)
+ (C-call "glGetString" (make-alien 'char) (C-enum "GL_VERSION")))
+ ((vendor)
+ (C-call "glGetString" (make-alien 'char) (C-enum "GL_VENDOR")))
+ ((extensions)
+ (C-call "glGetString" (make-alien 'char) (C-enum "GL_EXTENSIONS")))
+ (else
+ (error "Unknown gl String:" symbol))))))
(define %trace? #f)