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
) &key
(2d nil
))
18 (viewport 0 0 (width w
) (height w
))
19 (matrix-mode :projection
)
22 (ortho 0 (width w
) (height w
) 0 -
1 1)
23 (progn (glu:perspective
40 (/ (width w
) (height w
)) 3 100)
27 (matrix-mode :modelview
)
30 (defmethod display ((w fenster
))
31 (clear :color-buffer-bit
:depth-buffer-bit
)
34 (funcall (draw-func w
))
40 (defmethod reshape ((w fenster
) x y
)
45 (defmethod display-window :before
((w fenster
))
48 (defmethod passive-motion ((w fenster
) x y
)
49 (setf (aref (cursor-position w
) 0) x
50 (aref (cursor-position w
) 1) (- (height w
) y
)))
52 (defmethod keyboard ((w fenster
) key x y
)
54 (#\Esc
(destroy-current-window))))
56 (defmacro with-gui
(&body body
)
58 (make-instance 'gui
:fenster
59 :mode
'(:double
:rgb
:depth
)
60 :draw-func
#'(lambda ()