Пакет GLUT не существует, хотя cl-opengl установлен в Arch Linux

У меня есть emacs, настроенный со SLIME для разработки на Common Lisp (sbcl) в Arch Linux. Дело в том, что теперь я хочу начать работать и с OpenGL, поэтому я установил cl-opengl, чтобы обеспечить необходимые привязки. Я также установил символическую ссылку на .local/share/common-lisp на /usr/share/common-lisp (таким образом я смогу загружать все системы, использующие ASDF).

Однако, когда я пытаюсь скомпилировать следующий код в SLIME (используя C-c C-k)

(require :asdf)                 ; need ASDF to load other things
(asdf:load-system :cl-opengl)   ; load OpenGL bindings
(asdf:load-system :cl-glu)      ; load GLU bindings
(asdf:load-system :cl-glut)     ; load GLUT bindings

(defclass my-window (glut:window)
  ()
  (:default-initargs :width 400 :height 300
                     :title "My Window Title"
                     :x 100 :y 100
                     :mode '(:double :rgb :depth)))

(defmethod glut:display-window :before ((win my-window))
  (gl:shade-model :smooth)        ; enables smooth shading
  (gl:clear-color 0 0 0 0)        ; background will be black
  (gl:clear-depth 1)              ; clear buffer to maximum depth
  (gl:enable :depth-test)         ; enable depth testing
  (gl:depth-func :lequal)         ; okay to write pixel if its depth
                                  ; is less-than-or-equal to the
                                  ; depth currently written
                                  ; really nice perspective correction
  (gl:hint :perspective-correction-hint :nicest)
)

(defmethod glut:display ((win my-window))
  (gl:clear :color-buffer-bit :depth-buffer-bit)
  (gl:load-identity))

(defmethod glut:reshape ((win my-window) width height)
  (gl:viewport 0 0 width height)  ; reset the current viewport
  (gl:matrix-mode :projection)    ; select the projection matrix
  (gl:load-identity)              ; reset the matrix

  ;; set perspective based on window aspect ratio
  (glu:perspective 45 (/ width (max height 1)) 1/10 100)
  (gl:matrix-mode :modelview)     ; select the modelview matrix
  (gl:load-identity)              ; reset the matrix
)

(glut:display-window (make-instance 'my-window))

Я получаю следующую ошибку:

READ error during COMPILE-FILE:
Package GLUT does not exist.

хотя cl-glut.asd существует в /usr/share/common-lisp/systems.

Что я делаю неправильно?


person Manuel Olguín    schedule 22.04.2013    source источник
comment


Ответы (1)


ASDF:LOAD-SYSTEM не вступает в силу до момента загрузки, так как это обычная функция. Если вы хотите, чтобы эффект происходил во время компиляции, вы должны обернуть его в форму eval-when. Но лучше написать определение системы, которое :depends-on относится к другим системам.

person Xach    schedule 23.04.2013