;;; The following lines added by ql:add-to-init-file: #-quicklisp (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))) (when (probe-file quicklisp-init) (load quicklisp-init))) (ql:quickload "cl-opengl") (ql:quickload "cl-glu") (ql:quickload "cl-glut")sample.lisp
(cffi:defcallback renderscene :void () (gl:clear :color-buffer-bit) (gl:flush)) (defun setuprc () (gl:clear-color 0.0 0.0 1.0 1.0)) (defun main() (glut:init-display-mode :single :RGB) (glut:init) (glut:create-window "hello") (glut:display-func (cffi:callback renderscene) ) (setuprc) (glut:main-loop))後來發現(ql:quickload "cl-opengl") (ql:quickload "cl-glu") (ql:quickload "cl-glut")只用做一次就好了, 之後只用(require 'cl-opengl) (require 'cl-glut) (require 'cl-glu)便可以了。
.sbclrc
;;; The following lines added by ql:add-to-init-file: #-quicklisp (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))) (when (probe-file quicklisp-init) (load quicklisp-init)))sample.lisp
(require 'cl-opengl) (require 'cl-glut) (require 'cl-glu) (cffi:defcallback renderscene :void () (gl:clear :color-buffer-bit) (gl:color 0.0 0.0 1.0 ) (gl:rect 100 150 150 100) (gl:flush)) (cffi:defcallback changeSize :void ((w :int) (h :int)) (if (= h 0) (setf h 1)) (gl:viewport 0 0 w h ) (gl:matrix-mode :projection ) (gl:load-identity) (if (<= w h) (gl:ortho 0 250 0 (/ (* 250 h ) w) 1 -1) (gl:ortho 0 (/ (* 250 w ) h) 0 250 1 -1)) (gl:matrix-mode :modelview ) (gl:load-identity)) (defun setuprc () (gl:clear-color 0.0 0.0 0.0 1.0)) (defun main() (glut:init-display-mode :single :RGB) (glut:init) (glut:init-window-size 250 250) (glut:create-window "hello") (glut:display-func (cffi:callback renderscene) ) (glut:reshape-func (cffi:callback changesize) ) (setuprc) (glut:main-loop))
沒有留言:
張貼留言