5

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)))))
Fderal
  • 457
  • 1
  • 6
  • 11
  • 1
    No one can help you, if you not explaining what you doing and what you got. As I see, this is a style warning, not an error. – sheikh_anton Aug 17 '14 at 15:58
  • 1
    @coredump, while these messages are indeed warnings, undefined function in code is nothing good at all. – Mark Karpov Aug 17 '14 at 16:20
  • 1
    @Mark, Couldn't it be defined in another place and just not proclaimed as function in this compilation unit? – sheikh_anton Aug 17 '14 at 17:59
  • @coredump, I have included my code. – Fderal Aug 17 '14 at 19:47
  • 3
    What are init-gl and draw-frame ? Are they part of cl-opengl or some other library ? If so, why don't they prefixed with a package name (gl: or sdl: etc.) ? – cybevnm Aug 17 '14 at 21:16
  • As @cybevnm said, you must prefix draw-frame and init-gl with package name, or include it in your namespace by calling use-package. – sheikh_anton Aug 18 '14 at 02:30

2 Answers2

2

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!

Community
  • 1
  • 1
smt
  • 359
  • 3
  • 8
1

You should install quicklisp. Then to load all the packages you only need to do (ql:quickload '<system-name>). All three system's you are using are available through quicklisp and many more.

PuercoPop
  • 6,707
  • 4
  • 30
  • 40