 
 ! column major order
 
-: gl-flip ( angle -- ) deg>rad
-{ [ dup 2 * cos ] [ dup 2 * sin ] 0 0
-  [ dup 2 * sin ] [ 2 * cos neg ] 0 0
-  0 0 1 0
-  0 0 0 1 } make* >c-double-array glMultMatrixd ;
+: gl-flip ( angle -- ) deg>rad dup dup dup
+  [ 2 * cos ,   2 * sin ,       0 ,   0 ,
+    2 * sin ,	2 * cos neg ,   0 ,   0 ,
+          0 ,             0 ,   1 ,   0 , 
+	  0 ,		  0 ,	0 ,   1 , ]
+  { } make >c-double-array glMultMatrixd ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 : circle ( -- )
-color> gl-set-hsba
-gluNewQuadric dup 0 0.5 20 10 gluDisk gluDeleteQuadric ;
+  color> gl-set-hsba
+  gluNewQuadric dup 0 0.5 20 10 gluDisk gluDeleteQuadric ;
 
 : triangle ( -- )
-color> gl-set-hsba
-GL_POLYGON glBegin
-   0    0.577 glVertex2d
-   0.5 -0.289 glVertex2d
-  -0.5 -0.289 glVertex2d
-glEnd ;
+  color> gl-set-hsba
+  GL_POLYGON glBegin
+    0    0.577 glVertex2d
+    0.5 -0.289 glVertex2d
+   -0.5 -0.289 glVertex2d
+  glEnd ;
 
 : square ( -- )
-color> gl-set-hsba
-GL_POLYGON glBegin
-  -0.5  0.5 glVertex2d
-   0.5  0.5 glVertex2d
-   0.5 -0.5 glVertex2d
-  -0.5 -0.5 glVertex2d
-glEnd ;
+  color> gl-set-hsba
+  GL_POLYGON glBegin
+    -0.5  0.5 glVertex2d
+     0.5  0.5 glVertex2d
+     0.5 -0.5 glVertex2d
+    -0.5 -0.5 glVertex2d
+  glEnd ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 : size ( scale -- ) dup 1 glScaled ;
 
-: s ( scale -- ) size ;
-
 : size* ( scale-x scale-y -- ) 1 glScaled ;
 
-: s* ( scale-x scale-y -- ) size* ;
-
 : rotate ( angle -- ) 0 0 1 glRotated ;
 
-: r ( angle -- ) rotate ;
-
 : x ( x -- ) 0 0 glTranslated ;
 
 : y ( y -- ) 0 swap 0 glTranslated ;
 
 : flip ( angle -- ) gl-flip ;
 
-: f ( angle -- ) flip ;
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: s  size ;
+: s* size* ;
+: r  rotate ;
+: f  flip ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 : do ( quot -- )
-push-modelview-matrix
-push-color
-call
-pop-modelview-matrix
-pop-color ;
+  push-modelview-matrix
+  push-color
+  call
+  pop-modelview-matrix
+  pop-color ; inline
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 


VAR: start-shape

: initial-color ( -- hsba ) 0 0 0 1 <hsba> new ;

: display ( -- )

!   GL_LINE_SMOOTH glEnable
!   GL_BLEND glEnable
!   GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA glBlendFunc
!   GL_POINT_SMOOTH_HINT GL_NICEST glHint

!   GL_FOG glEnable
!   GL_FOG_MODE GL_LINEAR glFogi
!   GL_FOG_COLOR { 0.5 0.5 0.5 1.0 } >c-double-array glFogfv
!   GL_FOG_DENSITY 0.35 glFogf
!   GL_FOG_HINT GL_DONT_CARE glHint
!   GL_FOG_START 1.0 glFogf
!   GL_FOG_END 5.0 glFogf

  GL_PROJECTION glMatrixMode
  glLoadIdentity

  init-modelview-matrix-stack
  init-color-stack

  set-initial-color

  color> gl-set-hsba

  start-shape> call ;

: cfdg-window* ( -- )
  [ display ] closed-quot <slate>
  { 500 500 } over set-slate-dim
  dup "CFDG" open-window ;

