[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] bb:glwindow usage?

From: felix winkelmann
Subject: Re: [Chicken-users] bb:glwindow usage?
Date: Thu, 14 Apr 2005 09:01:21 +0200

On 4/14/05, Matt Gushee <address@hidden> wrote:
> Okay, I suppose this is really a stupid question--I don't understand
> OpenGL very well yet.
> But anyway, I see that bb has a glwindow widget. Good; I think I'd like
> to use it. But I'm puzzled as to how it works. First of all, is it
> supposed to work in combination with the gl egg? If so, I can't
> understand how to tell gl to use a particular glwindow widget. Would
> someone be so kind as to post a minimal example?

Here is a (very minimal) one:

;; Dancing square:

(use bb gl srfi-17)


(define *w* (bb:make-widget 'glwindow 640 480))
(define (rnd n) (+ (/ (random 2) 10) -0.1 n))

(define (redraw)
  (gl:Clear gl:COLOR_BUFFER_BIT)
  (gl:Begin gl:POLYGON)
  (gl:Vertex2f (rnd -0.5) (rnd -0.5))
  (gl:Vertex2f (rnd -0.5) (rnd 0.5))
  (gl:Vertex2f (rnd 0.5) (rnd 0.5))
  (gl:Vertex2f (rnd 0.5) (rnd -0.5))
  (gl:Flush) )

(set! (bb:property *w* 'callback) redraw)

(bb:show *w*)
(gl:ClearColor 0 0 0 1)

(let loop ()
  (bb:run 0.01)
  (bb:redraw *w*)
  (when (bb:property *w* 'visible) (loop)) )

I haven't been able to get the gears example to run, yet.
Note also that bb's support for interfacing with FLTK's OpenGL
stuff isn't overly large.

BTW, setting the 'resizable property for a 'glwindow doesn't
work. I don't know why, but will investigate...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]