This shows Lush displaying animated OpenGL graphics
with shading, lighting, etc. Here is how you draw a teapot
in Lush using the OpenGL/OpenGLU/GLUT libraries:
;; draw a teapot at x,y,z with angles theta,phi,rho
(de teapot(x y z theta phi rho)
((-float-) x y z theta phi rho)
(let ((mat (float-matrix 4)))
(glPushMatrix)
(glTranslatef x y z)
(glrotatef theta phi rho 1)
(mat 0 0.1745) (mat 1 0.01175) (mat 2 0.01175) (mat 3 1.0)
(glMaterialfv @GL_FRONT @GL_AMBIENT mat)
(mat 0 0.61424) (mat 1 0.04136) (mat 2 0.04136)
(glMaterialfv @GL_FRONT @GL_DIFFUSE mat)
(mat 0 0.727811) (mat 1 0.626959) (mat 2 0.626959)
(glMaterialfv @GL_FRONT @GL_SPECULAR mat)
(glMaterialf @GL_FRONT @GL_SHININESS (* 0.6 128.0))
(glColor3f 1 1 1)
(glut-solid-teapot 1.0)
(glPopMatrix)))
|