Skip to content

Instantly share code, notes, and snippets.

@fjolnir
Created August 15, 2012 13:24
Show Gist options
  • Save fjolnir/3360098 to your computer and use it in GitHub Desktop.
Save fjolnir/3360098 to your computer and use it in GitHub Desktop.
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