diff options
-rw-r--r-- | ground.c | 6 | ||||
-rw-r--r-- | ground.vert | 3 |
2 files changed, 5 insertions, 4 deletions
@@ -62,11 +62,11 @@ install_ground_transform(void) */ memcpy(&temp, &gluIdentityMatrix, sizeof(gluIdentityMatrix)); temp.col[0].values[0] = (1.0 - 0.0) / 2.0; - temp.col[0].values[3] = temp.col[0].values[0] + 0.0; + temp.col[3].values[0] = temp.col[0].values[0] + 0.0; temp.col[1].values[1] = (1.0 - 0.0) / 2.0; - temp.col[1].values[3] = temp.col[1].values[1] + 0.0; + temp.col[3].values[1] = temp.col[1].values[1] + 0.0; temp.col[2].values[2] = (1.0 - 0.0) / 2.0; - temp.col[2].values[3] = (1.0 - 0.0) / 2.0; + temp.col[3].values[2] = (1.0 - 0.0) / 2.0; gluMult4m_4m(&world_to_shadow_texcoords, &temp, &world_to_light_ndc); diff --git a/ground.vert b/ground.vert index f4d7713..4fbfe4d 100644 --- a/ground.vert +++ b/ground.vert @@ -15,7 +15,8 @@ void main() */ gl_Position = mvp * gl_Vertex; vertex_eye = vec3(mv * gl_Vertex); - shadow_coords = (light_mvp * gl_Vertex).xy; + vec4 temp = light_mvp * gl_Vertex; + shadow_coords = (temp).xy / temp.w; /* mat3 tbn = mat3(t, cross(n, t), |