Created
February 17, 2012 13:00
-
-
Save kristianlm/1853289 to your computer and use it in GitHub Desktop.
chicken scheme - opengl hello world in 35 lines (gl, glu, glut)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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