Last active
December 25, 2015 16:39
-
-
Save Madsy/7007230 to your computer and use it in GitHub Desktop.
This file contains 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
(define modelview (list | |
(1.0 0.0 0.0 0.0) | |
(0.0 1.0 0.0 0.0) | |
(0.0 0.0 1.0 0.0) | |
(0.0 0.0 0.0 1.0))) | |
(define projection (list | |
(1.0 0.0 0.0 0.0) | |
(0.0 9.0/16.0 0.0 0.0) | |
(0.0 0.0 1.0 1.0) | |
(0.0 0.0 0.0 0.0))) | |
(define m #nil) | |
(define tex #nil) | |
(with-mgl | |
(set! m (mgl-create-mesh-from-file "cube.3ds")) ;encapsulates VBOs, VAO and shader | |
(set! tex (mgl-create-texture-from-file "cube.png")) | |
(mgl-enable-blending) | |
(mgl-enable-depth-test) | |
(mgl-clear-color (1.0 0.0 0.0 1.0))) | |
(while (true? running) | |
(with-mgl | |
(mgl-clear :color :depth :stencil) | |
(mgl-use-model m) | |
(mgl-uniform-matrix "modelview" modelview) | |
(mgl-uniform-matrix "projection" projection) | |
(mgl-uniform "rotateVel" 20.0) | |
(mgl-bind-texture 0 tex) ;bind tex to GL_TEXTURE0. Sampler names follow strict convention | |
(mgl-render)) ;wrapper for glDrawArrays. Also reads state from bound model m | |
(mgl-delay 1)) ;ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment