require 'gl3'

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

a_run=: verb define
wd A
glaRC''
glaFont 'arial 30 italic'
NB. glaUsefontBitmaps args
NB. (must be 0),(index first char),(#chars),(call list base)
glaUseFontBitmaps 0 32 128 1032
glEnable GL_DEPTH_TEST
glColorMaterial GL_FRONT, GL_AMBIENT_AND_DIFFUSE
glEnable GL_COLOR_MATERIAL
fLightPosition =. _1 _1 1
glLight GL_LIGHT0, GL_POSITION, fLightPosition,0
glEnable GL_LIGHTING
glEnable GL_LIGHT0
glClearColor 1 1 1 1

glaFont 'arial 60'
NB. glaUseFontOutlines arguments
NB. (must be 0),(index first char),(#chars),(call list base)
NB. (deviation),(extrusion)
NB. deviation - specifies the maximum chordal deviation from the original outlines.
NB. When deviation is zero, the chordal deviation is equivalent to one design unit
NB. of the original font. The value of deviation must be equal to or greater than 0.
NB. extrusion - specifies how much a font is extruded in the negative z direction.
NB. The value must be equal to or greater than 0.
NB. When extrusion is 0, the display lists are not extruded.
NB. format - specifies the format, either WGL_FONT_LINES or WGL_FONT_POLYGONS, to use in the display lists. When format is WGL_FONT_LINES, the wglUseFontOutlines function creates fonts with line segments. When format is WGL_FONT_POLYGONS, wglUseFontOutlines creates fonts with polygons.
fontdata=:glaUseFontOutlines 0 65 3 1000 0 0.1 , WGL_FONT_POLYGONS
wd 'pshow;ptop'
)

a_g_size=:verb define
wh=.glqwh''
glViewport 0 0,wh
glMatrixMode GL_PROJECTION
glLoadIdentity''
gluPerspective 30, (%/wh), 1 10
)

a_g_paint =: verb define
glClear GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT
glMatrixMode GL_MODELVIEW
glLoadIdentity''
glTranslate _1 0 _5
glRotate _60 0 1 0
glColor 1 0 0 1
glCallList 1000
glColor 0 1 0 1
glCallList 1001
glColor 0 0 1 1
glCallList 1002
glaSwapBuffers''
)

a_run''
