如何使用SBCL安装CL-Opengl?

Fde*_*ral 5 lisp opengl installation sbcl common-lisp

所以我只是想知道如何为 SBCL 安装 opengl?我使用的是 64 位 Windows 8 笔记本电脑。我确实使用了quicklisp和quickload,但是当我在程序中实际使用它时,我收到如下错误:

; compilation unit finished
;   Undefined functions:
;     DRAW-FRAME INIT-GL
;   caught 2 STYLE-WARNING conditions
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

(require 'cl-opengl)
(require 'cl-glu)
(require 'lispbuilder-sdl)

(defun main-loop ()
  (sdl:with-init ()
    (sdl:window 800 800
        :title-caption "OpenGL Test"
        :opengl t
        :opengl-attributes '((:sdl-gl-doublebuffer 1)
                             (:sdl-gl-depth-size 16)))
    (setf (sdl:frame-rate) 20)

    (init-gl)
    (draw-frame)
    (sdl:update-display)

    (sdl:with-events ()
      (:quit-event () t)
      (:video-expose-event ()
        (sdl:update-display))
      (:idle ()
        (draw-frame)
        (sdl:update-display)))))
Run Code Online (Sandbox Code Playgroud)

小智 2

我快速浏览了您的代码似乎来自的页面。

看来编译器没有说谎,并且(init-gl)(draw-frame)没有定义。

据我所知,上述页面的作者后来添加了(draw-frame)如下定义:

(defun draw-frame (rotx roty rotz) (gl:matrix-mode :modelview) (gl:push-matrix) (gl:translate 0.5 0.5 0.5) (gl:rotate rotx 1 0 0) (gl:rotate roty 0 1 0) (gl:rotate rotz 0 0 1) (gl:translate -0.5 -0.5 -0.5) (draw-figure +cube-vertices+ +cube-faces+) (gl:pop-matrix))

不过,它看起来(init-gl)后来被重命名为(start),开头是这样的:

(defun start () (let ((rotx 0) (roty 0) (rotz 0))

作者描述(init-gl)为设置“查看参数、照明、剔除、模型视图矩阵等”,这看起来正是他的函数(start)所完成的功能。

顺便说一句,cybevnm提出了所有正确的问题,回答这些问题可能会让您得出类似的结论。

干杯!