如何用SBCL安装CL-Opengl?

时间:2014-08-17 15:50:02

标签: opengl install lisp common-lisp sbcl

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

; compilation unit finished
;   Undefined functions:
;     DRAW-FRAME INIT-GL
;   caught 2 STYLE-WARNING conditions

这是我的代码:

(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)))))

2 个答案:

答案 0 :(得分:1)

您应该安装quicklisp。然后加载您只需要执行(ql:quickload '<system-name>)的所有包。你正在使用的所有三个系统都可以通过quicklisp等等获得。

答案 1 :(得分:1)

我快速浏览了the page that your code seems to have come from.

似乎编译器没有说谎,(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提出了所有正确的问题,回答这些问题可能会让你得出类似的结论。

干杯!