Skip to content

Instantly share code, notes, and snippets.

@floooh
Last active August 29, 2015 14:01
Show Gist options
  • Save floooh/8eb627385aef9fcedbc9 to your computer and use it in GitHub Desktop.
Save floooh/8eb627385aef9fcedbc9 to your computer and use it in GitHub Desktop.
Testing Oryol shader template syntax
only exactly one @ tag per line
@block MyTransform
@uniform mat4 mvp ModelViewProj
vec4 transform(vec4 pos) {
return mvp * pos;
}
@end
@vs MyVertexShader
@use MyTransform [...] // @use has 'varargs'
@in vec4 position
@in vec4normal
@in vec2 texcoord0
@out vec2 uv
void main() {
$position = transform(position);
uv = texcoord0;
}
@end
@fs MyFragmentShader
@uniform sampler2D tex ColorTexture
@in vec2 uv
void main() {
$color = $texture2D(tex, uv);
}
@end
@bundle MyBundle
@program MyVertexShader MyFragmentShader
@end
@stateblock MyStateBlock
@state CullFaceEnabled true
@state ColorMask true true true false
@state ClearColor 1.0f 1.0f 1.0f 0.0f
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment