
(defclass gl-font-window (glut:window)
  ((font-loader :initarg :font :initform (error "Must give a font"))
   (string      :initarg :string))
  (:default-initargs :width 640
                     :height 480
		     :title "Font Test"
		     :string "Font Test"
		     :mode '(:single :rgb :stencil)))

(defmethod glut:display-window :before ((w gl-font-window))
  (gl:clear-color 1 1 0.7 0))

(defmethod glut:display ((w gl-font-window))
  (gl:clear :color-buffer-bit)
  (gl:color 0 0 0 1)
  (with-slots (font-loader string) w
    (draw-string font-loader string :size 156 :filled t))
  (gl:flush))

(defmethod glut:mouse ((w gl-font-window) button state x y)
  (declare (ignore w button state x y))
  (glut:post-redisplay))

(defmethod glut:reshape ((w gl-font-window) width height)
  (gl:viewport 0 0 width height)
  (gl:matrix-mode :projection)
  (gl:load-identity)
  (gl:ortho -320 320 -240 240 -1 1)
  (gl:matrix-mode :modelview)
  (gl:load-identity))

