;; This example illustrates drawing a basic mesh (import scheme (chicken base) (chicken bitwise) (prefix glfw3 #:glfw) (prefix epoxy #:gl) gl-math gl-utils) (define *vertex* #<gl (mesh-mode rect)) (mesh-n-indices rect) (type->gl (mesh-index-type rect)) #f) (check-error) (gl:bind-vertex-array 0)) (glfw:key-callback (lambda (window key scancode action mods) (cond ((and (eq? key glfw:+key-escape+) (eq? action glfw:+press+)) (glfw:set-window-should-close window #t))))) (glfw:with-window (640 480 "Example" resizable: #f) (set! *vertex* (make-shader gl:+vertex-shader+ *vertex*)) (set! *fragment* (make-shader gl:+fragment-shader+ *fragment*)) (program (make-program (list *vertex* *fragment*))) (mesh-make-vao! rect `((position . ,(gl:get-attrib-location (program) "position")) (color . ,(gl:get-attrib-location (program) "color")))) (let loop () (glfw:swap-buffers (glfw:window)) (gl:clear (bitwise-ior gl:+color-buffer-bit+ gl:+depth-buffer-bit+)) (render) (glfw:poll-events) (unless (glfw:window-should-close (glfw:window)) (loop))))