source: project/gl-display-glx/samples/s01.scm @ 3547

Last change on this file since 3547 was 3547, checked in by thu, 14 years ago

commit before removal of non gl-display files

  • Property svn:executable set to *
File size: 992 bytes
Line 
1#! /bin/sh
2#|
3exec csi -s $0 "$@"
4|#
5
6; This sample shows a square, a grid.
7; It prints "space" when the space key is pressed.
8; It waits for another event when the escape key is released
9; then quits.
10
11(require-extension srfi-18)
12(require-extension gl-display-glx)
13(require 'gl-display-events-util)
14(require 'gl-util)
15(require 'gl-proj)
16
17(define *display* (gl-display:create 400 200))
18(gl-util:initialize)
19(gl-proj:viewport *display*)
20(gl-proj:perspective *display*)
21
22;(enable-backface-culling)
23
24(define continue #t)
25(define (loop)
26  (when continue
27    (process-events *display*
28                    (lambda (event)
29                      ; TODO resize
30                      (cond
31                        ((space-key-pressed? event)
32                         (print "space"))
33                        ((escape-key-released? event)
34                         (set! continue #f)))))
35    (clear)
36    (gl:LoadIdentity)
37    (gl:Translatef 0  0 -6)
38    (square-xy 1)
39    (grid 7 0.2)
40    (gl-display:swap *display*)
41    (thread-sleep! 0.02)
42    (loop)))
43(loop)
44(write-event (wait-event *display*))
45(gl-display:destroy *display*)
Note: See TracBrowser for help on using the repository browser.