Draw walls using perspective divide

This commit is contained in:
2021-03-18 12:58:17 +01:00
parent e98e7256d2
commit 447268117c
5 changed files with 80 additions and 17 deletions
+31
View File
@@ -0,0 +1,31 @@
#version 430 core
layout (triangles) in;
layout (triangle_strip, max_vertices = 4) out;
in vec4 vParams[];
uniform mat4 worldMat;
vec2 lightPos = gl_in[0].gl_Position.xy;
vec2 cornerA = gl_in[1].gl_Position.xy;
vec2 cornerB = gl_in[2].gl_Position.xy;
void main()
{
gl_Position = worldMat * vec4(cornerA, 1, 1 );
EmitVertex();
gl_Position = worldMat * (vec4(cornerA, 10, 1 ) + (20,20,0,0));
gl_Position = vec4(1,0, 10, 1 );
EmitVertex();
gl_Position = worldMat * vec4(cornerB, 0, 1 );
gl_Position = vec4(0,1, -10, 1 );
EmitVertex();
gl_Position = worldMat * (vec4(cornerB, 0, 1 ) + (20,20,0,0));
gl_Position = vec4(1,1, 10, 1 );
EmitVertex();
EndPrimitive();
}