(extern void glClearDepth (depth GLdouble))
(extern void glEnable (cap GLenum))
+(extern void glDisable (cap GLenum))
(enum (GL_DEPTH_TEST))
+(enum (GL_COLOR_MATERIAL))
(extern void glDepthFunc (func GLenum))
(enum (GL_LEQUAL))
+(extern void glCullFace (mode GLenum))
+
+(enum (GL_FRONT)
+ (GL_FRONT_AND_BACK)
+ (GL_BACK))
+
(extern void glHint (target GLenum) (mode GLenum))
(enum (GL_PERSPECTIVE_CORRECTION_HINT))
(enum (GL_NICEST))
+(extern void glColorMaterial (face GLenum) (mode GLenum))
+
+(enum (GL_DIFFUSE))
+
(extern void glClear (mask GLbitfield))
(enum (GL_COLOR_BUFFER_BIT)
(extern void gl_material (face GLenum) (pname GLenum) (params SCM))
(extern void glMatrixMode (mode GLenum))
+(enum (GL_PROJECTION) (GL_MODELVIEW))
(extern void glNewList (list GLuint) (mode GLenum))
(GL_BACK_RIGHT)
(GL_BACK_LEFT)
(GL_POSITION)
- (GL_FRONT)
(GL_AMBIENT_AND_DIFFUSE)
- (GL_PROJECTION)
- (GL_MODELVIEW)
(GL_COMPILE)
(GL_FLAT))
\f
gl:clear-color
gl:clear-depth
gl:enable
+ gl:disable
gl:depth-func
+ gl:cull-face
gl:hint
+ gl:color-material
gl:clear
gl:load-identity
glu:look-at
- gl:scaled
+ gl:scale
gl:begin
gl:color
gl:vertex
(import (gtk)
add-gc-cleanup punt-gc-cleanup error-if-null
gobject-alien gtk-window-new
+ gtk-widget-destroy gtk-widget-parent
+ gtk-widget-show-all
+ gtk-widget-queue-draw
+ set-gtk-widget-draw-callback!
gtk-window-set-opacity
gtk-window-set-title
set-gtk-window-delete-event-callback!
gtk-container-add
gtk-widget-show-all
<fix-widget>
- fix-widget-realize-callback)
+ fix-widget-realize-callback
+ set-fix-widget-key-press-handler!)
(export (gl)
- make-glx-device with-glx-device glx:swap-buffers <glx-widget>))
+ make-glx-widget with-glx-widget glx:swap-buffers <glx-widget>
+ with-glx-viewport <glx-viewport>))
(define-package (gl glxgears)
(files "gl-glxgears")
(guarantee-gl-depth depth 'GL:CLEAR-DEPTH)
(C-call "glClearDepth" depth))
+(define (->capability cap operator)
+ (case cap
+ ((DEPTH-TEST) (C-enum "GL_DEPTH_TEST"))
+ ((CULL-FACE) (C-enum "GL_CULL_FACE"))
+ ((LIGHT0) (C-enum "GL_LIGHT0"))
+ ((LIGHTING) (C-enum "GL_LIGHTING"))
+ ((NORMALIZE) (C-enum "GL_NORMALIZE"))
+ ((COLOR-MATERIAL) (C-enum "GL_COLOR_MATERIAL"))
+ (else (error:wrong-type-argument cap "a GL capability" operator))))
+
(define (gl:enable capability)
(guarantee-current 'GL:ENABLE)
- (C-call "glEnable"
- (case capability
- ((DEPTH-TEST) (C-enum "GL_DEPTH_TEST"))
- ((CULL-FACE) (C-enum "GL_CULL_FACE"))
- ((LIGHT0) (C-enum "GL_LIGHT0"))
- ((LIGHTING) (C-enum "GL_LIGHTING"))
- ((NORMALIZE) (C-enum "GL_NORMALIZE"))
- (else (error "Unknown glEnable capability:" capability)))))
+ (C-call "glEnable" (->capability capability 'GL:ENABLE)))
+
+(define (gl:disable capability)
+ (guarantee-current 'GL:DISABLE)
+ (C-call "glDisable" (->capability capability 'GL:DISABLE)))
(define (gl:depth-func function)
(guarantee-current 'GL:DEPTH-FUNC)
((LEQUAL) (C-enum "GL_LEQUAL"))
(else (error "Unknown glDepthFunc function:" function)))))
+(define (gl:cull-face mode)
+ (guarantee-current 'GL:CULL-FACE)
+ (C-call "glCullFace"
+ (case mode
+ ((FRONT) (C-enum "GL_FRONT"))
+ ((BACK) (C-enum "GL_BACK"))
+ ((FRONT-AND-BACK) (C-enum "GL_FRONT_AND_BACK"))
+ (else (error "Unknown glCullFace mode:" mode)))))
+
(define (gl:hint target mode)
(guarantee-current 'GL:HINT)
(C-call "glHint"
((NICEST) (C-enum "GL_NICEST"))
(else (error "Unknown glHint mode:" mode)))))
+(define (gl:color-material face mode)
+ (C-call "glColorMaterial"
+ (case face
+ ((FRONT) (C-enum "GL_FRONT"))
+ (else (error "Unknown glColorMaterial face:" face)))
+ (case mode
+ ((DIFFUSE) (C-enum "GL_DIFFUSE"))
+ (else (error "Unknown glColorMaterial mode:" mode)))))
+
(define (gl:clear . bits)
(guarantee-current 'GL:CLEAR)
(C-call "glClear"
(guarantee-current 'GL:LOOK-AT)
(C-call "glu_look_at" position aim up))
-(define (gl:scaled kx ky kz)
- (guarantee-current 'GL:SCALED)
- (guarantee-flonum kx 'GL:SCALED)
- (guarantee-flonum ky 'GL:SCALED)
- (guarantee-flonum kz 'GL:SCALED)
+(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)
(C-call "glScaled" kx ky kz))
(define (gl:begin mode)