 : (all-enabled) ( seq quot -- )
     over [ glEnable ] each dip [ glDisable ] each ; inline
 : (all-enabled-client-state) ( seq quot -- )
-    over [ glEnableClientState ] each dip [ glDisableClientState ] each ; inline
+    [ dup [ glEnableClientState ] each ] dip
+    dip
+    [ glDisableClientState ] each ; inline
 
 MACRO: all-enabled ( seq quot -- )
     >r words>values r> [ (all-enabled) ] 2curry ;

: fix-coordinates ( point1 point2 -- x1 y2 x2 y2 )
    [ first2 [ >fixnum ] bi@ ] bi@ ;

! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

: gl-color ( color -- ) first4 glColor4d ; inline

: gl-clear-color ( color -- )

    gl-clear-color GL_COLOR_BUFFER_BIT glClear ;

: color>raw ( object -- r g b a )
    >rgba { [ red>> ] [ green>> ] [ blue>> ] [ alpha>> ] } cleave ;

: set-color ( object -- ) color>raw glColor4d ;
: set-clear-color ( object -- ) color>raw glClearColor ;

: gl-error ( -- )
    glGetError dup zero? [
