paroj / gltut

Learning Modern 3D Graphics Programming
https://paroj.github.io/gltut/
MIT License
1.57k stars 377 forks source link

Is "Hello, Triangle!" missing a cleanup bindBuffer? #69

Open paroj opened 11 years ago

paroj commented 11 years ago

Originally reported by: Inês Almeida (Bitbucket: brita, GitHub: brita)


In the display function, in "Chapter 1. Hello, Triangle!", after glDrawArrays, the AttribPointer is disabled, as well as the program, but not the vertex buffer object. Is it missing?

#!c++

    glUseProgram(theProgram);

    glBindBuffer(GL_ARRAY_BUFFER, positionBufferObject);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0);

    glDrawArrays(GL_TRIANGLES, 0, 3);

    glDisableVertexAttribArray(0);
    // glBindBuffer(GL_ARRAY_BUFFER, 0);  // ?
    glUseProgram(0);

Also, you have a minor typo at the very beginning of: "Chapter 2. Playing with Colors", in: "The methods are to using the fragment's position to compute a color and to using per-vertex data to compute a color."