require 'gl3'

A=: noun define
pc a closeok;
xywh 0 0 100 100;cc g isigraph ws_clipchildren ws_clipsiblings rightmove bottommove;
pas 0 0;
rem form end;
)

a_run=: verb define
wd A
glaRC''
wd 'pshow;ptop'
)

a_g_char =: verb define
R =: 360 | R + 2 * 'xyz' = 0 { sysdata
glpaintx''
)

a_g_size=:verb define
wh=.glqwh''
glViewport 0 0,wh
glMatrixMode GL_PROJECTION
glLoadIdentity''
if. </wh do.
 glOrtho _5 5,(_5 5*%%/wh), _5 5
else.
 glOrtho (_5 5*%/wh), _5 5 _5 5
end.
)

a_g_paint =: verb define
glClearColor 0 0 0 0
glClear GL_COLOR_BUFFER_BIT
bezier ''
glaSwapBuffers ''
)

bezier=:verb define
ctrlpoints=: _4 _4 0 _2 4 0 2 _4 0 4 4 0
glMap1 GL_MAP1_VERTEX_3, 0, 1, 3,4, ctrlpoints
glEnable GL_MAP1_VERTEX_3
glColor 1 1 1 1
glBegin GL_LINE_STRIP
 glEvalCoord1"0 (i.30)%30
glEnd''
glPointSize 5
glColor 1 0 0 1
glBegin GL_POINTS
 glVertex 4 3$ctrlpoints
glEnd''
)

a_run''
