[plt-scheme] SGL - swap-buffers
This is my first attempt at answering a support question (I'm usually on
the other end) but here goes...
>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)
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)))
You can inherit the swap-gl-buffers method so you can call it
by itself without needing the (send this ...)
-Ryan