[plt-scheme] SGL - swap-buffers

From: Zbyszek Jurkiewicz (zbyszek at duch.mimuw.edu.pl)
Date: Mon Oct 13 12:46:01 EDT 2003

On Mon, 13 Oct 2003, Ryan Jarvis wrote:

> >On Mon, 13 Oct 2003, Zbyszek Jurkiewicz wrote:
> >
> > (define (on-paint)
> >   (send this with-gl-context (lambda () (draw)))
> >   (send this swap-gl-buffers))
> > ...
> >
> > (define (on-paint)
> >   (send this with-gl-context
> >          (lambda ()
> >            (draw)
> >            (send this swap-gl-buffers))))
> > ...
> >
> 
> When you redefine a method in a class, you can only give one lambda
> expression, I believe.  The problem with your first code snippet is that
> you have two expressions, a send and another send.
> 
> When I try to compile your code on a WinXP machine using DrScheme, I get
> an error that says
> (define: bad syntax (zero or multiple expressions after identifier)

Strange, because it is perfectly correct, shortened version of
procedure definition (and it works everywhere).

> 
> Whereas your second snippet has only one expression, a send, it works
> fine.
> 
> Try something like this
> (define on-paint (lambda () (send a-canvas with-gl-context draw)
>                    (swap-gl-buffers)))

No, I tried something similar and it did not, but I will give it
a try.

> 
> You can inherit the swap-gl-buffers method so you can call it
> by itself without needing the (send this ...)

Yes, this is just dehydrated excerpt from the larger class
definition.

> 
> -Ryan
> 
> 


Posted on the users mailing list.