Lisp HUG Maillist Archive

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


Re: OpenGL examples

On Thu, 13 Jan 2005 23:43:42 +0000, joel reymont <joelr1@gmail.com> wrote:
> 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!

I dug up some sample code in the archives that displays triangles and
such. I can't manager to display a texture, though.

    Thanks, Joel

-- 
Tenerife > Canary Islands > Spain


Updated at: 2020-12-10 08:53 UTC