I am currently using sgl to draw to a window, and using the screenshot progrm 
to convert tie picture to a .png file.
Unfortunately, this seems to linut the png to screen size, and I need more 
pixels thatn that for my application.

So my guess is that I need to create an sgl-compatible opengl environment that 
draws toa bitmap instead of a window, and then use the tools available to write 
that bitmap out as a .png file.

Trouble is, I don't know how to get a bitmap out of sgl.

Here's the function I use to vreate the window and call a function called 
drawer to draw into it.

(define (environ drawer)
  #;(printf "in environ\n")
  (define my-canvas%
    (class* canvas% ()
      (inherit with-gl-context swap-gl-buffers)
      
      (define/override (on-paint) ; When is on-paint caled?
        (printf "on-paint ~s~n" (count))
        (with-gl-context
            (lambda ()
              #;(printf "call drawer~n")
              (drawer)
              #;(printf "returned from drawer~n")
              (swap-gl-buffers)
              )
          )
        )

      (define/override (on-size width height) ; Is this what is called when 
resizing the window with a mouse?
        (with-gl-context
            (lambda ()
              (resize width height)
              )
          )
        )
      
      (super-instantiate () (style '(gl))) ; What is this?
      )
    )
  #;(printf "before win~n")
  (define win (new frame% (label "OpenGl Test")
                               (min-width 600)
                               (min-height 600)))
  #;(printf "before my-canvas~n")
  (define gl (new my-canvas% (parent win)))
  #;(printf "before show~n")
  (send win show #t)  ;  presumably this runs the on-paint method.
  ;     But why does it get called three times?
  #;(printf "out-environ~n")
  )

-- hendrik

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20220424215803.GB14417%40topoi.pooq.com.

Reply via email to