Skip to content

Instantly share code, notes, and snippets.

@kristianlm
Created February 17, 2012 13:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kristianlm/1853289 to your computer and use it in GitHub Desktop.
Save kristianlm/1853289 to your computer and use it in GitHub Desktop.
chicken scheme - opengl hello world in 35 lines (gl, glu, glut)
(begin
(require-extension gl)
(require-extension glut)
(require-extension glu)
(glut:InitDisplayMode (+ glut:DOUBLE glut:RGBA glut:DEPTH))
(glut:InitWindowSize 400 300)
(glut:CreateWindow "gl hello world"))
(begin
(gl:MatrixMode gl:PROJECTION)
(gl:LoadIdentity)
(gl:Frustum -1.6 1.6
-2.4 2.4
5 30)
(gl:MatrixMode gl:MODELVIEW)
(gl:LoadIdentity))
(begin
(gl:ClearColor 0 0 (/ (random 100) 100) 1)
(gl:Clear (+ gl:COLOR_BUFFER_BIT))
(gl:Color4f 1 1 0 1)
(gl:LoadIdentity)
(gl:Translatef 0.0 0.0 -10)
(gl:Begin gl:TRIANGLES)
(gl:Vertex3f 0.0 1.0 0.0)
(gl:Vertex3f -1.0 -1.0 0.0)
(gl:Vertex3f 1.0 -1.0 0.0)
(gl:End)
(gl:Flush)
(glut:SwapBuffers))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment