NB. J in a Box
NB.
NB. If FIXBOX is 1, the box is fixed while
NB. the J can move around.

NB. Use the J K L keyboard keys to move it
NB. out of the box, and F4 to restore.

FIXBOX=: 1

INIROT=: 20 25 0
INIVIEW=: 0 0 2.5

CLEARCOLOR=: 0.2 0 0.2

BOX=: 0.65 * 1 pick cube''
ROTXYZ=: INIROT
VIEWXYZ=: INIVIEW

demo=: 3 : 0
if. IFJAVA do. glaFont'serif 50 bold'
else. glaFont '"Times New Roman" 10 bold' end.
j=. ,glaUseFontOutlines 0 74 1 1000 0 0.3 1
'x y w h'=. 4{.,j
if. IFJAVA do. OFF=: (-w+0.5*x),(-h+0.5*y),0
else. OFF=: (-w+0.5*x),(-h-0.5*y),0.15 end.
stdlistlight''
dj makenewlist''
db makenewlist''
)

dj=: 3 : 0
glPushMatrix''
glTranslate OFF
glcolor LIMEGREEN
glCallLists 1000
glPopMatrix''
)

db=: 3 : 0
if. FIXBOX do.
  glPushMatrix''
  glLoadIdentity''
  gluLookAt INIVIEW,0 0 0 0 1 0
  glRotate INIROT,.ID3
end.
glPushAttrib GL_LIGHTING_BIT
glDisable GL_LIGHTING
drawlines BOX;'';BLUE
glEnable GL_LIGHTING
glPopAttrib''
if. FIXBOX do. glPopMatrix'' end.
)
