Created
August 15, 2012 13:24
-
-
Save fjolnir/3360098 to your computer and use it in GitHub Desktop.
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
GlutInit(0, nil) | |
GlutInitDisplayMode(GLUT_DOUBLE) | |
GlutInitWindowSize(640, 480) | |
GlutInitWindowPosition(200, 200) | |
GlutCreateWindow("Tranquil is cool as beans!") | |
GlClearColor(0, 0, 0, 0) | |
GlScalef(0.4, 0.4, 0.4) | |
GlutDisplayFunc({ | |
GlRotatef(0.1, 0, 1, 0) | |
GlClear(GL_COLOR_BUFFER_BIT) | |
GlColor3f(0, 1, 0) | |
GlutWireDodecahedron() | |
GlColor3f(1, 1, 1) | |
GlutWireTeapot(0.7) | |
GlutSwapBuffers() | |
}) | |
lastX, lastY = 0 | |
GlutMotionFunc({ x, y | | |
dx, dy = lastX - x, lastY - y | |
GlRotatef(dx, 0, 1, 0) | |
GlRotatef(dy, 1, 0, 0) | |
lastX, lastY = x, y | |
}) | |
GlutIdleFunc(GlutPostRedisplay) | |
GlutMainLoop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment