I hauled the sgl-hello-world program (attached below) into drrracket, version 7.6, english by PLT.
I click on 'run'I click on 'run'.
It creates a small window containing a small white square.
I click on 'run' again.
It deetes that window, and creates another small window
containing a small white square.
I click on 'run' again.
It deetes that window, and creates another small window
containing a small white square.
I click on 'run' again.
It deetes that window, and creates another small window
containing a small white square.
etc.
After about 35 runs, the new small window instead contains a large white
square filling the entire window.
Evidently, something happens after multiple runs. Perhaps spme resource
is exhausted Perhaps it's random and might happen after a hundred runs
another time? I don't know. But I'm having similarly erratic behaviour
in a far more complicated program, and this is the simplest version of
erraticity I've found so far.
This code was found on the Racket users mailing list archives.
-- hendrik
--------------
#lang racket/gui
; This code from
https://groups.google.com/forum/#!topic/racket-users/-84bgybC3C0
; -- hendrik
(require (lib "gl.ss" "sgl")
(lib "gl-vectors.ss" "sgl")
)
(define (resize w h)
(glViewport 0 0 w h)
#t
)
(define (draw-opengl)
(glClearColor 0.0 0.0 0.0 0.0)
(glClear GL_COLOR_BUFFER_BIT)
(glColor3d 1.0 1.0 1.0)
(glMatrixMode GL_PROJECTION)
(glLoadIdentity)
(glOrtho 0.0 1.0 0.0 1.0 -1.0 1.0)
(glMatrixMode GL_MODELVIEW)
(glLoadIdentity)
(glBegin GL_QUADS)
(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)
(glEnd)
)
(define my-canvas%
(class* canvas% ()
(inherit with-gl-context swap-gl-buffers)
(define/override (on-paint)
(with-gl-context
(lambda ()
(draw-opengl)
(swap-gl-buffers)
)
)
)
(define/override (on-size width height)
(with-gl-context
(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)
; It should be pretty easy to tweak it.
; Hope this helps,
; Laurent
; - show quoted text -
; - show quoted text -
; _________________________________________________
; For list-related administrative tasks:
;
http://lists.racket-lang.org/listinfo/users