[plt-scheme] v300, my notes

From: Ivanyi Peter (pivanyi at freemail.hu)
Date: Mon Jan 2 08:11:53 EST 2006


During the holiday I have converted to my SX modeller to
PLT-Scheme v300.  However a couple of things came up. It is
long e-mail, I am sorry.

- This is just a note. OpenGL uses the foreign function
interface library. It is generally very easy to "convert"
(or make available) the OpenGL functions in Scheme, but one
of the crucial functions is the glSelectBuffer. This is the
fourth version of glSelectBuffer that I see; guile, bigloo
and others do it differently. I do not know the foreign
func. interface library, but maybe it is worth reconsidering
this function. For example, for large number of elements
every time the glSelectBuffer function is called a large
memory is allocated. (I have a workaround for this, but I
would prefer if the library supports something better.)
Related to this: Is there a way to convert the c-vector to
vector, without first converting it to a list? (Maybe I
missed something.)

- As the case sensitivity is introduced I have noticed a
strange thing. In DrScheme when I select the "Pretty Big"
Language or similar and I do not switch on the case
sensitivity then it is impossible to call OpenGL functions.
For example after: (require (lib "gl.ss" "sgl")) and typing
glbegin DrScheme reports an error. When case sensitivity is
switched on glBegin is OK. Is this behaviour documented
anywhere? Is it normal?

- Run the following Scheme snippet in DrScheme and you will
notice that the line of the boxed panel crosses the button.
If there is a label for the boxed panel the spacing is all
right. I presume this is a bug.

(define win (new frame% (label "test") (min-width 1)
(min-height 1)))
(define grp (new group-box-panel% (parent win) (label "")))
(define hor1 (new horizontal-panel% (parent grp)))
(new message% (label "aa") (parent hor1))
(new button%  (label "aa") (parent hor1) (callback (lambda
(b e) #f)))
(send win show #t)

- There is an important (at least to me) difference in the
appearance of the button in Windows and Linux. In Windows
there is no border while in Linux there is a 2 or more pixel
border. This means that in Linux the buttons are spaced
further away from each other and they do not look so neat.
Is there a way to get rid of the border in Linux?

- My last note is again Linux related. I have a Debian
system, and I have compiled v300 on it and installed.
Everything seems fine with the following problems. (None of
them was a problem with v209.)
If I run the following "gl-base.scm" OpenGL program in
DrScheme twice, then DrScheme crashes for the second time
with Segmentation Fault. The program is good, it runs under
v209 and under v300 on Windows. It should display a white
square in the middle of a black background. And there is a
second problem with it that even when I run it for the first
time it does not display anything only a white background.
(I have also checked my SX modeller and the OpenGL screen
update is not the same as it was in v209. For example when I
pull down a menu, select something, so the menu disappears,
the underlying OpenGL canvas does not get refreshed and a
white square remains where the menu area was.)
Can anyone confirm the same behaviour for the gl-base.scm

Thanks for any help with any of the above problems.

Best regards,

Peter Ivanyi

--------------- gl-base.scm ------------------------

(require (lib "gl.ss" "sgl")
         (lib "gl-vectors.ss" "sgl")

(define (resize w h)
  (glViewport 0 0 w h)

(define (draw-opengl)
  (glClearColor 0.0 0.0 0.0 0.0)
  (glClear gl_color_buffer_bit)
  (glColor3d 1.0 1.0 1.0)
  (glOrtho 0.0 1.0 0.0 1.0 -1.0 1.0)
  (glBegin gl_polygon)
  (glVertex3d 0.25 0.25 0.0)
  (glVertex3d 0.75 0.25 0.0)
  (glVertex3d 0.75 0.75 0.0)
  (glVertex3d 0.25 0.75 0.0)

(define my-canvas%
  (class* canvas% ()
    (inherit with-gl-context swap-gl-buffers)
   (define/override (on-paint)
        (lambda ()
    (define/override (on-size width height)
        (lambda ()
          (resize width height)
    (super-instantiate () (style '(gl)))

(define win (new frame% (label "OpenGl Test") (min-width
200) (min-height 200)))
(define gl  (new my-canvas% (parent win)))

(send win show #t)

Halld és lásd a 20. századot! Cikkek és videók a század történelmi eseményeiről
az [origo] Múltkor oldalán. http://mult-kor.hu/cikk.php?article=12020

Posted on the users mailing list.