finished nehe tut... just displays a opengl window

This commit is contained in:
Dan Ballard 2011-06-28 07:48:42 -07:00
parent b7f2ae8b96
commit 10e37e3607
1 changed files with 15 additions and 3 deletions

View File

@ -22,7 +22,7 @@
(gl:clear-color 0 0 0 0) ; background will be black (gl:clear-color 0 0 0 0) ; background will be black
(gl:clear-depth 1) ; clear buffer to minimum depth (gl:clear-depth 1) ; clear buffer to minimum depth
(gl:enable :depth-test) ; enable depth testing (gl:enable :depth-test) ; enable depth testing
(gl:depth-function :lequal) ; okay to write pixel if its depth (gl:depth-func :lequal) ; okay to write pixel if its depth
; is less-than-or-equal to the ; is less-than-or-equal to the
; depth xcurrently written ; depth xcurrently written
(gl:hint :perpective-correction-hint :nicest) ; really nice perspective correction (gl:hint :perpective-correction-hint :nicest) ; really nice perspective correction
@ -34,9 +34,21 @@
(gl:clear :color-buffer-bit :depth-buffer-bit) (gl:clear :color-buffer-bit :depth-buffer-bit)
(gl:load-identity)) (gl:load-identity))
(defmethod glut:reshape ((win my-window) wight height) (defmethod glut:reshape ((win my-window) width height)
;;; prepare viewport ;;; prepare viewport
(gl:viewport 0 0 width height) ; reset current viewport (gl:viewport 0 0 width height) ; reset current viewport
;;; glut reshape -- prepare project
(gl:matrix-mode :projection) ; select the projection matrix
(gl:load-identity) ; reset the matrix
;; set perspective based on window aspect ratio
(glu:perspective 45 (/ width (max height 1)) 1/10 100)
;;; glut reshape -- switch to model view
(gl:matrix-mode :modelview) ;select the model view matrix
(gl:load-identity) ; reset the matrix
)
#<:use "create an instance of our window">
;;; create an instance of our window
(glut:display-window (make-instance 'my-window))