vtgl

terminal emulator implemented in OpenGL
git clone anongit@rnpnr.xyz:vtgl.git
Log | Files | Refs | Feed | LICENSE

vert_render.glsl (599B)


      1 #version 460 core
      2 
      3 in vec2 position;
      4 
      5 uniform mat4 u_Pmat;
      6 uniform vec2 u_vertscale[512];
      7 uniform vec2 u_vertoff[512];
      8 
      9 out VS_OUT {
     10 	vec2 tex_coord;
     11 	flat int index;
     12 } vs_out;
     13 
     14 void main()
     15 {
     16 	vec2 scale  = u_vertscale[gl_InstanceID];
     17 	vec2 offset = u_vertoff[gl_InstanceID];
     18 
     19 	mat4 transform = mat4(
     20 		scale.x,  0,        0, 0,
     21 		0,        scale.y,  0, 0,
     22 		0,        0,        1, 0,
     23 		offset.x, offset.y, 0, 1
     24 	);
     25 
     26 	gl_Position = u_Pmat * transform * vec4(position, 0.0, 1.0);
     27 
     28 	vs_out.tex_coord   = position;
     29 	vs_out.tex_coord.y = 1.0 - vs_out.tex_coord.y;
     30 	vs_out.index       = gl_InstanceID;
     31 }