polyadvent

A game engine from scratch in C
git clone git://jb55.com/polyadvent
Log | Files | Refs | README

ui.v.glsl (398B)


      1 #include profile
      2 
      3 in vec3 position;
      4 in vec3 color;
      5 in vec2 tex_coords;
      6 
      7 out vec3 v_color;
      8 out vec2 v_tex_coords;
      9 
     10 uniform mat4 mvp;
     11 uniform vec2 uipos;
     12 uniform vec2 uisize;
     13 
     14 void main()
     15 {
     16     vec2 v2_pos = uipos + uisize * (position.xy - vec2(0.5, 0.5));
     17     vec4 v4_pos = vec4(v2_pos, 0.0, 1.0) ;
     18     gl_Position = mvp * v4_pos;
     19 
     20     v_tex_coords = tex_coords;
     21     v_color = color + v4_pos.xyz;
     22 }