Created
March 25, 2012 23:17
-
-
Save nilium/2201317 to your computer and use it in GitHub Desktop.
GLFW/webgl test in CoffeeScript
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
| glfw = require('node-glfw') | |
| gl = require('node-webgl').webgl | |
| glfw.Init() | |
| glfw.OpenWindow 800, 600, 0, 0, 0, 0, 16, 0, glfw.WINDOW | |
| glfw.events.addListener 'keyup', (event) -> | |
| glfw.CloseWindow() if event.which is glfw.KEY_ESC | |
| # /listener | |
| running = yes | |
| while running | |
| grey = Math.abs Math.sin glfw.GetTime() | |
| gl.clearColor grey, grey, grey, 1.0 | |
| gl.clear gl.COLOR_BUFFER_BIT | |
| running = glfw.GetWindowParam glfw.OPENED | |
| glfw.SwapBuffers() | |
| # /running | |
| glfw.Terminate() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment