-
-
Save davexunit/a861ccfabc9843b32c95aaead1879572 to your computer and use it in GitHub Desktop.
S-expression representation of GLSL
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-graphics-variable sprite-shader | |
(make-shader* | |
((in vec2 position) | |
(in vec2 tex) | |
(out vec2 fragTex) | |
(uniform mat4 mvp) | |
(define (void main) | |
(= fragTex tex) | |
(= gl_Position (* mvp (vec4 (-> position xy) 0.0 1.0))))) | |
((in vec2 fragTex) | |
(out vec4 fragColor) | |
(uniform sampler2D colorTexture) | |
(uniform vec4 tint) | |
(define (void main) | |
(= fragColor (* (texture colorTexture fragTex) tint)))))) | |
;; Generated vertex shader code: | |
;; in vec2 position;in vec2 tex;out vec2 fragTex;uniform mat4 mvp;void main(){(fragTex = tex);(gl_Position = (mvp * vec4(position.xy,0.0,1.0)));}; | |
;; Generated fragment shader code: | |
;; in vec2 fragTex;out vec4 fragColor;uniform sampler2D colorTexture;uniform vec4 tint;void main(){(fragColor = (texture(colorTexture,fragTex) * tint));}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment