Skip to content

Instantly share code, notes, and snippets.

@khlorghaal
Last active February 28, 2023 01:58
Show Gist options
  • Save khlorghaal/f3376d0a02adcc93385cc857a60bcbec to your computer and use it in GitHub Desktop.
Save khlorghaal/f3376d0a02adcc93385cc857a60bcbec to your computer and use it in GitHub Desktop.
layout(location=0) in ivec3 in_p;
smooth out vec2 v_uv;//ints cant smooth
void main(){
//instanced triangle fan
const ivec2[] lxy= ivec2[](
ivec2(-4,-4),
ivec2(-4, 4),
ivec2( 4, 4),
ivec2( 4,-4)
);
gl_Position= project( //project is mapping function onto screenspace, ie view matrix
in_p.xy*8 + lxy[gl_VertexID],
in_p.z);
const vec2[] luv= vec2[](
ivec2( 0, 0),
ivec2( 0, 8),
ivec2( 8, 8),
ivec2( 8, 0)
);
v_uv= luv[gl_VertexID];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment