NB. texture basic demo with bitmap
NB.
NB. the J bitmap is read from file, and
NB. set as a texture for a cube face.

CLR=: RGBA BLUE,:WHITE
PATTERN=: CLR {~ readbmp jpath '~system\examples\data\jbw.bmp'

CLEARCOLOR=: GRAY
COLOR=: 0 0.75 0.75
ROTXYZ=: 25 25 0
VIEWXYZ=: 0 0 7

demo=: 3 : 0
gentexture2D PATTERN
stdlistlight''
bcube makenewlist ''
jface makenewlist ''
)

jface=: 3 : 0
glBegin GL_QUADS
glNormal 0 0 1
glTexCoord 0 0 0 1
glVertex _1 1 1
glTexCoord 0 1 0 1
glVertex _1 _1 1
glTexCoord 1 1 0 1
glVertex 1 _1 1
glTexCoord 1 0 0 1
glVertex 1 1 1
glEnd''
)

bcube=: 3 : 0
a=. 1 1 0 1 1 1#cubeface ''
a=. (% |@{.@,) a
a=. (; unitnormal) a
glPushAttrib GL_ENABLE_BIT
glDisable GL_TEXTURE_2D
drawsolid a,<COLOR
glPopAttrib ''
)

demo''
