This commit is contained in:
2025-08-30 16:29:54 +02:00
parent 3e81e2018c
commit 12e3d5a9d8
2 changed files with 5 additions and 2 deletions

View File

@@ -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.

View File

@@ -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