opengl_learn

Step-by-step introduction to OpenGL
git clone https://0xdd.org/code/opengl_learn.git
Log | Files | Refs | README | LICENSE

commit 39dd3cf30febe75c207214f96aa7751f5a226ce7
parent 18313f152b7961d46583701959e150ccd13c2e2e
Author: David DiPaola <DavidDiPaola@users.noreply.github.com>
Date:   Mon,  4 Jun 2018 08:32:36 -0400

00,01: was disabling the wrong vertex attrib array

Diffstat:
M00-triangle.c | 4++--
M01-perspective.c | 4++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/00-triangle.c b/00-triangle.c @@ -65,7 +65,7 @@ main() { } do { - glClear(GL_COLOR_BUFFER_BIT); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glUseProgram(program_ID); @@ -81,7 +81,7 @@ main() { ); glDrawArrays(GL_TRIANGLES, 0, 3); // 3 indices starting at 0 -> 1 triangle glBindBuffer(GL_ARRAY_BUFFER, 0); - glDisableVertexAttribArray(triangle_vertex_buffer_ID); + glDisableVertexAttribArray(program_attribute_position_ID); glfwSwapBuffers(window); glfwPollEvents(); diff --git a/01-perspective.c b/01-perspective.c @@ -92,7 +92,7 @@ main() { } do { - glClear(GL_COLOR_BUFFER_BIT); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glUseProgram(program_ID); ogl_program_uniform_set_mat4f(program_ID, "MVP", MVP); @@ -109,7 +109,7 @@ main() { ); glDrawArrays(GL_TRIANGLES, 0, 3); // 3 indices starting at 0 -> 1 triangle glBindBuffer(GL_ARRAY_BUFFER, 0); - glDisableVertexAttribArray(triangle_vertex_buffer_ID); + glDisableVertexAttribArray(program_attribute_position_ID); glfwSwapBuffers(window); glfwPollEvents();