:: with-vertex-array ( id quot -- )
id glBindVertexArray
- quot [ binding 0 glBindVertexArray ] [ ] cleanup ; inline
+ quot [ 0 glBindVertexArray ] [ ] cleanup ; inline
: <gl-buffer> ( target data hint -- id )
pick gen-gl-buffer [
: with-gl-context ( world quot -- )
'[ set-gl-context @ ]
- [ flush-gl-context gl-error ] bi ; inline
+ [ handle>> flush-gl-context gl-error ] bi ; inline
ERROR: no-world-found ;
: find-gl-context ( gadget -- )
find-world dup
- [ handle>> set-gl-context ] [ no-world-found ] if ;
+ [ set-gl-context ] [ no-world-found ] if ;
: (request-focus) ( child world ? -- )
pick parent>> pick eq? [
[ call-next-method ]
[
dup handle>>
- [ set-gl-context resize-world ]
- [ drop ] if*
+ [ [ set-gl-context ] [ resize-world ] bi ]
+ [ drop ] if
] bi ;
GENERIC: draw-world* ( world -- )
dup draw-world? [
dup world [
[
- dup handle>> [ draw-world* ] with-gl-context
+ dup [ draw-world* ] with-gl-context
flush-layout-cache-hook get call( -- )
] [
over <world-error> ui-error
: set-up-window ( world -- )
{
- [ handle>> set-gl-context ]
+ [ set-gl-context ]
[ [ title>> ] keep set-title ]
[ begin-world ]
[ resize-world ]
: (ungraft-world) ( world -- )
{
- [ handle>> set-gl-context ]
+ [ set-gl-context ]
[ text-handle>> [ dispose ] when* ]
[ images>> [ dispose ] when* ]
[ hand-clicked close-global ]
[ hand-gadget close-global ]
[ end-world ]
- [ [ [ [ dispose ] when* ] each V{ } clone ] change-window-resources ]
+ [ [ [ [ dispose ] when* ] each V{ } clone ] change-window-resources drop ]
} cleave ;
M: world ungraft*
f swap open-window* ;
: into-window ( world quot -- world )
- [ dup handle>> ] dip with-gl-context ; inline
+ [ dup ] dip with-gl-context ; inline