Closed jw3877 closed 7 years ago
I think this question is coming from this sentence in the pdf "The VBO containing the vertex positions of each object should be uploaded only once to the GPU.". It is ok to upload again the positions whenever you are switching shading mode, what is important is that you are NOT uploading the positions every time a model is moved/scaled/rotated --- this should be done using a transformation in the vertex shader.
If you prefer to be consistent and avoid to use the element buffer for the Phong shading that is fine. It will be a bit slower to render, but this is not a problem for the mesh sizes that you have in Assignment 3.
1) For this assignment, is it recommended to have two VBOs for each mesh -- the first storing only vertex positions and the second storing everything else (color, normal, etc)?
This way we can upload the position VBO only once but continue to re-upload the color/normal VBO to the GPU as changes are needed.
It seems confusing to break up the vertex attributes like this, is it worth it to avoid re-uploading the position floats to the GPU whenever we need to change the color/normals?
2) Should we avoid using element buffers?
In rendering mode "Phong Shading", the vertex normal will be the average of the neighboring triangle normals -- all triangles sharing the vertex will expect the same normal. But in "Flat Shading" mode, all 3 vertices in each triangle need to share the same normal -- the calculated normal of the triangle -- so that the same normal is used throughout the triangle in lighting equations in the fragment shader.
If the same vertex is shared by 2 triangles and we use indexing, it will use the same vertex and thus the same normal for both triangles, and that is not what we want.