1

Arch Linux の Common Lisp (sbcl) で開発するために SLIME で構成された emacs があります。問題は、OpenGL の使用も開始したいので、必要なバインディングを提供するために cl-opengl をインストールしたことです。また、.local/share/common-lisp に /usr/share/common-lisp へのシンボリック リンクを設定しました (この方法で ASDF を使用するすべてのシステムをロードできるはずです)。

ただし、SLIME で次のコードをコンパイルしようとすると (Cc Ck を使用)

(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 に存在しますが。

私は何を間違っていますか?

4

1 に答える 1

3

ASDF:LOAD-SYSTEM単純な関数であるため、ロード時まで有効になりません。コンパイル時に効果を発生させたい場合は、eval-whenフォームでラップする必要があります。しかし、それらの他のシステムよりもシステム定義を作成する方がよいでしょう:depends-on

于 2013-04-23T00:51:18.017 に答える