     (make-reflection-texture) >>reflection-texture
     (make-reflection-depthbuffer) [ >>reflection-depthbuffer ] keep
     (make-reflection-framebuffer) >>reflection-framebuffer
+    t >>initialized?
     drop ;
 
 M: spheres-gadget ungraft* ( gadget -- )
+    f >>initialized?
     dup find-gl-context
     {
         [ reflection-framebuffer>> [ delete-framebuffer ] when* ]

    ] bi ;

: reflection-frustum ( gadget -- -x x -y y near far )
    [ near-plane ] [ far-plane ] bi [
        drop dup [ -+ ] bi@
    ] 2keep ;

: (reflection-face) ( gadget face -- )
    swap reflection-texture>> >r >r

        ]
    } cleave ;

M: spheres-gadget draw-gadget* ( gadget -- )
    dup initialized?>> [ (draw-gadget) ] [ drop ] if ;

: spheres-window ( -- )
    [ <spheres-gadget> "Spheres" open-window ] with-ui ;

