3 (defclass fenster
(window)
4 ((cursor-position :accessor cursor-position
5 :initform
(make-array 2 :element-type
'fixnum
)
6 :type
(simple-array fixnum
(2)))
7 (draw-func :accessor draw-func
10 (with-primitive :lines
11 (color 1 0 0) (vertex 0 0 0) (vertex 1 0 0)
12 (color 0 1 0) (vertex 0 0 0) (vertex 0 1 0)
13 (color 0 0 1) (vertex 0 0 0) (vertex 0 0 1)))
16 (defmethod set-view ((w fenster
) &optional
(2d nil
))
18 (viewport 0 0 (width w
) (height w
))
19 (matrix-mode :projection
)
22 (ortho 0 (width w
) (height w
) 0 -
1 1)
24 (glu:perspective
30 (/ (width w
) (height w
)) .01 100)
28 (matrix-mode :modelview
)
31 (defmethod reshape ((w fenster
) x y
)
36 (defmethod display-window :before
((w fenster
))
39 (defmethod display ((w fenster
))
40 (clear :color-buffer-bit
:depth-buffer-bit
)
43 (funcall (draw-func w
))
49 (defmethod passive-motion ((w fenster
) x y
)
50 (setf (aref (cursor-position w
) 0) x
51 (aref (cursor-position w
) 1) (- (height w
) y
)))
53 (defmethod keyboard ((w fenster
) key x y
)
55 (#\Esc
(destroy-current-window))))
57 (defmacro with-gui
(&body body
)
59 (make-instance 'gui
:fenster
60 :mode
'(:double
:rgb
:depth
)
61 :draw-func
#'(lambda ()