That example is quite involved. It doesn't show how to get things going without using chaos.
If I use (require mode-lambda/backend/gl) instead of (require mode-lambda/backend/software) and use a bitmap with gl backing like this: (define draw (rendering-states->draw lc (list fish-sprite lantern-sprite) (list flash-sprite))) (define glc (new gl-config%)) (define bm (make-gl-bitmap W H glc)) (define dc (new bitmap-dc% [bitmap bm])) (draw W H dc) bm Then I get this error: GL context changed OpenGL error in procedure glGetString: Error code 1286. This is still in DrRacket. 2016-12-28 2:03 GMT+01:00 Jay McCarthy <jay.mccar...@gmail.com>: > What you have is fine, but you need to give it a DC where > get-gl-context doesn't return false. (Such as by making a canvas with > the 'gl style.) In addition, you do NOT want a legacy context. > > I recommend looking at the example code: > > https://github.com/jeapostrophe/mode-lambda/blob/ > master/mode-lambda/examples/one.rkt > > On Tue, Dec 27, 2016 at 4:37 PM, Jens Axel Søgaard > <jensa...@soegaard.net> wrote: > > Hi All, > > > > I am experimenting with mode-lambda. The example below > > shows how to draw sprites on different layers using the software backend. > > However I would like to try the gl backend instead. > > > > What is the correct incantation? > > > > /Jens Axel > > > > > > #lang racket > > (require mode-lambda > > mode-lambda/static > > mode-lambda/text/static > > mode-lambda/text/runtime > > mode-lambda/color > > ; mode-lambda/backend/gl > > mode-lambda/backend/software > > racket/draw > > racket/gui/base > > pict > > pict/flash) > > > > ;;; > > ;;; BITMAPS > > ;;; > > (define fish-bm (pict->bitmap (standard-fish 100 50))) > > (define lantern-bm (pict->bitmap (jack-o-lantern 100))) > > (define flash-bm (pict->bitmap (colorize (linewidth 5 (outline-flash > 100 > > 100)) "yellow"))) > > > > ;;; > > ;;; SPRITES > > ;;; > > > > (define db (make-sprite-db)) > > (add-sprite!/bm db 'fish (λ() fish-bm)) > > (add-sprite!/bm db 'lantern (λ() lantern-bm)) > > (add-sprite!/bm db 'flash (λ() flash-bm)) > > (define cdb (compile-sprite-db db)) > > (define fish-idx (sprite-idx cdb 'fish)) > > (define lantern-idx (sprite-idx cdb 'lantern)) > > (define flash-idx (sprite-idx cdb 'flash)) > > > > ;;; > > ;;; LAYERS > > ;;; > > (define W 400) > > (define H 400) > > (define W/2 (/ W 2.)) > > (define H/2 (/ H 2.)) > > > > (define bgl (layer W/2 H/2)) ; background: layer 0 > > (define ml (layer W/2 H/2)) ; middle: layer 1 > > (define fgl (layer W/2 H/2)) ; foreground: layer 2 > > (define lc (vector bgl ml fgl)) ; layer config > > > > ;;; > > ;;; RUNTIME > > ;;; > > > > (define fish-sprite (sprite 200. 200. fish-idx #:layer 0)) ; > > background > > (define lantern-sprite (sprite 250. 200. lantern-idx #:layer 1)) ; middle > > (define flash-sprite (sprite 250. 200. flash-idx #:layer 2)) ; > > foreground > > > > (define rendering-states->draw (stage-draw/dc cdb W H 3)) ; XXX change 3 > to > > 2 and get a crash > > > > (define draw (rendering-states->draw lc (list fish-sprite lantern-sprite) > > (list flash-sprite))) > > (define bm (make-object bitmap% W H)) > > (define dc (new bitmap-dc% [bitmap bm])) > > (draw W H dc) > > bm > > > > -- > > 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. > > For more options, visit https://groups.google.com/d/optout. > > > > -- > Jay McCarthy > Associate Professor > PLT @ CS @ UMass Lowell > http://jeapostrophe.github.io > > "Wherefore, be not weary in well-doing, > for ye are laying the foundation of a great work. > And out of small things proceedeth that which is great." > - D&C 64:33 > -- -- Jens Axel Søgaard -- 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. For more options, visit https://groups.google.com/d/optout.