OpenGL examples
Folks,
Does anyone have a simple working OpenGL example? My sample code below
is not working, I'm new to OpenGL and the sphere example that comes
with LW is quite complicated. Thanks in advance!
P.S.
(in-package "CL-USER")
(load "~/work/opengl/host")
(load "~/work/opengl/load")
(use-package :opengl)
(defun redisplay-canvas (canvas &rest ignore)
(rendering-on
(canvas)
(gl-clear-color 0.0 0.0 3.0 0.0)
;;(gl-clear *gl-color-buffer-bit*)
;;(gl-clear *gl-depth-buffer-bit*)
(gl-clear (logior *gl-color-buffer-bit*
*gl-depth-buffer-bit*))
(gl-load-identity)
(gl-translatef -1.5 0.0 -6.0)
(gl-begin *gl-triangles*)
(gl-color3-f 1.0 1.0 1.0)
(gl-vertex3-f 0.0 1.0 0.0)
(gl-vertex3-f -1.0 -1.0 0.0)
(gl-vertex3-f 1.0 -1.0 0.0)
(gl-end)
(gl-translatef 3.0 0.0 0.0)
(gl-begin *gl-quads*)
(gl-vertex3-f -1.0 1.0 0.0)
(gl-vertex3-f 1.0 1.0 0.0)
(gl-vertex3-f 1.0 -1.0 0.0)
(gl-vertex3-f -1.0 -1.0 0.0)
(gl-flush)
(gl-end)))
;;(swap-buffers canvas)))
(defconstant *width* 794)
(defconstant *height* 538)
(setf pane (make-instance 'capi:opengl-pane
:min-width *width*
:min-height *height*
:display-callback 'redisplay-canvas
))
(capi:contain pane)
--
Tenerife > Canary Islands > Spain