DonkeyKong64 grind crash
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / routeui.h
1 #ifndef SHADER_routeui_H
2 #define SHADER_routeui_H
3 static void shader_routeui_link(void);
4 static void shader_routeui_register(void);
5 static struct vg_shader _shader_routeui = {
6 .name = "routeui",
7 .link = shader_routeui_link,
8 .vs =
9 {
10 .orig_file = "shaders/routeui.vs",
11 .static_src =
12 "layout (location=0) in vec2 a_co;\n"
13 "\n"
14 "uniform vec4 uOffset;\n"
15 "\n"
16 "void main()\n"
17 "{\n"
18 " vec2 vpos = a_co * uOffset.zw + uOffset.xy;\n"
19 " gl_Position = vec4(vpos,0.0,1.0);\n"
20 "}\n"
21 ""},
22 .fs =
23 {
24 .orig_file = "shaders/routeui.fs",
25 .static_src =
26 "out vec4 FragColor;\n"
27 "\n"
28 "uniform vec4 uColour;\n"
29 "\n"
30 "void main()\n"
31 "{\n"
32 " FragColor = uColour;\n"
33 "}\n"
34 ""},
35 };
36
37 static GLuint _uniform_routeui_uOffset;
38 static GLuint _uniform_routeui_uColour;
39 static void shader_routeui_uOffset(v4f v){
40 glUniform4fv(_uniform_routeui_uOffset,1,v);
41 }
42 static void shader_routeui_uColour(v4f v){
43 glUniform4fv(_uniform_routeui_uColour,1,v);
44 }
45 static void shader_routeui_register(void){
46 vg_shader_register( &_shader_routeui );
47 }
48 static void shader_routeui_use(void){ glUseProgram(_shader_routeui.id); }
49 static void shader_routeui_link(void){
50 _uniform_routeui_uOffset = glGetUniformLocation( _shader_routeui.id, "uOffset" );
51 _uniform_routeui_uColour = glGetUniformLocation( _shader_routeui.id, "uColour" );
52 }
53 #endif /* SHADER_routeui_H */