commit b7f2ae8b9622764ffaf2d0b90c5545eba084f0aa Author: Dan Ballard Date: Mon Jun 27 07:56:21 2011 -0700 NeHe intro lisp opengl diff --git a/1.lisp b/1.lisp new file mode 100644 index 0000000..23256a6 --- /dev/null +++ b/1.lisp @@ -0,0 +1,42 @@ +;;; glut-template.lisp + +;;; load opengl +(require :asdf) +(asdf:load-system :cl-opengl) +(asdf:load-system :cl-glu) +(asdf:load-system :cl-glut) + + +(defclass my-window (glut:window) + () + (:default-initargs :width 400 :height 300 + :title "My Window Title" + :x 100 :y 100 + :mode '(:double :rgb :depth))) + + +;;; initilization method +(defmethod glut:display-window :before ((win my-window)) + ;;; prepage opengl + (gl:shade-model :smooth) ; enables smooth shading + (gl:clear-color 0 0 0 0) ; background will be black + (gl:clear-depth 1) ; clear buffer to minimum depth + (gl:enable :depth-test) ; enable depth testing + (gl:depth-function :lequal) ; okay to write pixel if its depth + ; is less-than-or-equal to the + ; depth xcurrently written + (gl:hint :perpective-correction-hint :nicest) ; really nice perspective correction +) + + +;;; additional glut methods +(defmethod glut:display ((win my-window)) + (gl:clear :color-buffer-bit :depth-buffer-bit) + (gl:load-identity)) + +(defmethod glut:reshape ((win my-window) wight height) + ;;; prepare viewport + (gl:viewport 0 0 width height) ; reset current viewport + + +#<:use "create an instance of our window"> \ No newline at end of file