From b240f07c97362c3fee758a30b078d3dfbb0acbc6 Mon Sep 17 00:00:00 2001 From: un-clouded Date: Wed, 22 Jun 2022 11:48:09 +1200 Subject: [PATCH] Triangles in chapter 2, exercise 4 are now wound in anti-clockwise fashion. --- content/code/c2_exercise_4.txt | 4 ++-- content/code/c2_triangle_elements.txt | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/content/code/c2_exercise_4.txt b/content/code/c2_exercise_4.txt index ab51fe4..a3486d7 100644 --- a/content/code/c2_exercise_4.txt +++ b/content/code/c2_exercise_4.txt @@ -64,8 +64,8 @@ int main() glGenBuffers(1, &ebo); GLuint elements[] = { - 0, 1, 2, - 2, 3, 0 + 2, 1, 0, // Anti-clockwise winding + 0, 3, 2, }; glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo); diff --git a/content/code/c2_triangle_elements.txt b/content/code/c2_triangle_elements.txt index 6982d9f..1b2c594 100644 --- a/content/code/c2_triangle_elements.txt +++ b/content/code/c2_triangle_elements.txt @@ -65,8 +65,8 @@ int main() glGenBuffers(1, &ebo); GLuint elements[] = { - 0, 1, 2, - 2, 3, 0 + 2, 1, 0, // Anti-clockwise winding + 0, 3, 2, }; glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo); @@ -99,6 +99,8 @@ int main() glEnableVertexAttribArray(colAttrib); glVertexAttribPointer(colAttrib, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (void*)(2 * sizeof(GLfloat))); + //glEnable (GL_CULL_FACE); + bool running = true; while (running) {