gpt4 book ai didi

lisp - "Package GLUT does not exist",即使在 Arch Linux 中安装了 cl-opengl

转载 作者:太空宇宙 更新时间:2023-11-03 18:52:51 25 4
gpt4 key购买 nike

我为 emacs 配置了 SLIME,以便在 Arch Linux 上使用 Common Lisp (sbcl) 进行开发。问题是,我现在也想开始使用 OpenGL,所以我安装了 cl-opengl 以提供必要的绑定(bind)。我还在 .local/share/common-lisp 上设置了一个到/usr/share/common-lisp 的符号链接(symbolic link)(我应该能够以这种方式使用 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 中。

我做错了什么?

最佳答案

ASDF:LOAD-SYSTEM 直到加载时才会生效,因为它是一个普通函数。如果您希望效果在编译时发生,您必须将其包装在 eval-when 形式中。但是最好编写一个 :depends-on 其他系统的系统定义。

关于lisp - "Package GLUT does not exist",即使在 Arch Linux 中安装了 cl-opengl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16157045/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com