← Архив: Common Lisp

Пример с opengl-ем

Author: · 17.12.2012 21:33
· original author: root81
   Привет.
Пробую пример из http://lisper.ru/wiki/libraries:cl-opengl
krok@atom ~ $ sbcl
This is SBCL 1.0.58, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (asdf:oos 'asdf:load-op :cl-glut)
<cut>
* (asdf:oos 'asdf:load-op :cl-devil)
<cut>
* (asdf:oos 'asdf:load-op :cl-opengl)
#<ASDF:LOAD-OP NIL {B1414B9}>
NIL
* (load "opengl.lisp")
debugger invoked on a TYPE-ERROR in thread
#<THREAD "main thread" RUNNING {AB386D9}>:
  The value 1.0d0 is not of type SINGLE-FLOAT.
Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
  0: [RETRY   ] Retry EVAL of current toplevel form.
  1: [CONTINUE] Ignore error and continue loading file "/home/krok/opengl.lisp".
  2: [ABORT   ] Abort loading file "/home/krok/opengl.lisp".
  3:            Exit debugger, returning to top level.
(SB-IMPL::OPTIMIZED-DATA-VECTOR-SET
 #<unavailable argument>
 #<unavailable argument>
 #<unavailable argument>)
0] 1
T
* (run)
CORRUPTION WARNING in SBCL pid 17243(tid 3084949184):
Memory fault at 0 (pc=0xb5bf779a, sp=0xb778e2f4)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
debugger invoked on a SB-SYS:MEMORY-FAULT-ERROR in thread
#<THREAD "main thread" RUNNING {AB386D9}>:
  Unhandled memory fault at #x0.
Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.
(SB-SYS:MEMORY-FAULT-ERROR)
0] 0
Некое окно стартует, но там мусор. Кто подскажет в чем я не прав?
· original author: Menschenkindlein
У меня с использованием coerce:
(defun get-coordinates ()
  "Функция осуществляет пересчет X и Y координат точек многоугольника"
  (let ((temp (* 2 pi (/ *number-of-corners*))))
    (setf *coordinates* (make-array (list *number-of-corners* 2) :element-type 'short-float))
    (dotimes (i *number-of-corners*)
      (setf (aref *coordinates* i 0) (coerce (cos (* i temp)) 'short-float)
            (aref *coordinates* i 1) (coerce (sin (* i temp)) 'short-float)
)
)
)
)

перешло к следующей ошибке :)
· original author: root81
   Спасибо, ваш пример заработал. Может быть стоит изменить код в статье на ваш?
Да, на Ubuntu все чудесно, а на Gentoo все так же Memory fault... Но это уже не проблема кода.