diff --git a/report/task2.md b/report/task2.md index a609fee..c0f8b42 100644 --- a/report/task2.md +++ b/report/task2.md @@ -9,5 +9,8 @@ The clip box ensures that objects behind the camera and generally when geometry ## b) ### What happens? +The triangle is no longer visible. ### Why does it happen? +This is because of back-face culling. When the triangle is deemed to be facing away from the camera it is culled. And thus not rendered. ### What is the condition under which this effect occurs? +If the cross product of two arbitrary edges of a triangle, which respects the vertex order is negative. Because of this the ordering in the index buffer is important since it determines which wheter or not the triangle is considered facing away or towards the camera. diff --git a/src/main.rs b/src/main.rs index 904f64a..d14dcdf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -168,8 +168,8 @@ fn main() { // == // Set up your VAO around here - let vertices = vec![0.6, -0.8, -1.2, 0., 0.4, 0., -0.8, -0.2, 1.2]; - let indices = vec![0, 1, 2]; + let vertices = vec![-0.6, -0.6, 0., 0.6, -0.6, 0., 0., 0.6, 0.]; + let indices = vec![1, 0, 2]; let my_vao = unsafe { create_vao(&vertices, &indices) }; // == // Set up your shaders here