Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install CL-Opengl with SBCL?

So I was just wondering how to install opengl for SBCL? I'm on a 64-bit Windows 8 notebook. I did use quicklisp and quickload but when I actually use it in a program I get an error like this:

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

and this is my code:

(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)))))
like image 629
Fderal Avatar asked Oct 20 '22 03:10

Fderal


1 Answers

I took a quick look at the page that your code seems to have come from.

It appears that the compiler is not lying, and that (init-gl) and (draw-frame) are not defined.

From what I can tell, the author of the above page later included a definition of (draw-frame) that looks like this:

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

However, it looks like (init-gl) was later renamed to (start), which begins like this:

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

The author describes (init-gl) as setting up "the viewing parameters, lighting, culling, modelview matrix etc", which looks to be exactly what his function (start) accomplishes.

Incidentally, cybevnm was asking all the right questions, and answering those questions probably would have led you to a similar conclusion.

Cheers!

like image 78
smt Avatar answered Oct 23 '22 23:10

smt