Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.