[gambit-list] glut callbacks

Eduardo Cavazos wayo.cavazos at gmail.com
Sat Mar 21 17:12:13 EDT 2009


Eduardo Cavazos wrote:

> I was trying out the opengl library from the wiki.
> 
> Some of the functions in the glut library are used to specify callbacks. 
> For example, glutReshapeFunc.
> 
> In the glut libraries of Ypsilon, Larceny, and Chicken, I'm able to pass 
> a Scheme procedure to the 'glutReshapeFunc' procedure.
> 
> Is this doable with Gambit? From the sound of the manual, it seems like 
> this is not yet supported.

I'm thinking about going with a workaround along these lines.

This is how 'glutReshapeFunc' is defined in the library:

(define glutReshapeFunc
   (c-lambda ( (function (int int) void) ) void "glutReshapeFunc"))

So maybe define a helper procedure which *can* be passed to 
'glutReshapeFunc':

(c-define (basic-reshape-func width height)
           (int int)
           void
           "basicReshapeFunc"
           ""
           (glut-reshape-func width height))

That calls a procedure stored in a variable which may be set 
interactively at a REPL:

(define glut-reshape-func #f)

Ed



More information about the Gambit-list mailing list