[plt-scheme] some sgl help

From: briand at aracnet.com (briand at aracnet.com)
Date: Sat Nov 1 01:56:58 EST 2003

I've taken some simple gl code for a "triangle" programw which I found 
in the open-gl/mesa examples section.

I've included the on-paint code at the end of the e-mail.

The problem I have is that although the on-paint routine is getting
called, the sgl canvas just stays white, i.e. nothing gets drawn.

My other question : how can I get events which interact with the
sgl-canvas ?  Will normal mr-ed events work, e.g. mouse-clicks,
etc..., or is there some special trickery involved ?

Advice greatly appreciated.


Thanks

Brian


   (printf "on-size width:~a height:~a~n" width height)

   (gl-viewport 0 0 width height)
   ;; Start modifying the projection matrix.
   (gl-matrix-mode 'projection)
   ;; Reset project matrix.
   (gl-load-identity)
   ;; Map abstract coords directly to window coords.
   (gl-ortho 0.0 (exact->inexact width) 
             0.0 (exact->inexact height) 
             -1.0 1.0)
   ;; Invert Y axis so increasing Y goes down.
   (gl-scale 1.0 -1.0 1.0)
   ;; Shift origin up to upper-left corner.
   (gl-translate 0.0 (exact->inexact (- height)) 0.0)

   (gl-clear 'color-buffer-bit)

   (gl-begin 'triangles)
   ;; blue
   (gl-color 0.0 0.0 1.0)
   (gl-vertex 20 20)
   ;; green
   (gl-color 0.0 1.0 0.0)
   (gl-vertex 200 200)
   ;; red
   (gl-color 1.0 0.0 0.0)
   (gl-vertex 20 200)

   (gl-end)
   (gl-flush))))


Posted on the users mailing list.