Quiz 3
Quiz 3
Q1
3
An out variable from vertex shader outputs data is interpolated across the primitives and then provided as input to the in variable in the fragment shader for each pixel.
Q2
3
position arrays contains 18 elements;
normal arrays contains 18 elements;
Index array arrays contains 24 elements
Q3
2
CPU-side code indicates to the GPU which GPU-side objects to use by binding them with functions like glBindBuffer, glBindTexture, or glUseProgram, effectively telling the GPU which objects to operate on next. The CPU cannot directly access GPU-side objects because they reside in separate memory spaces; direct access would be inefficient and is abstracted away by the graphics API to manage communication over the bus efficiently.
Q4
4
The first line binds the buffer object bufPos
as the current vertex buffer, making it the source of vertex data for subsequent operations.
The second line specifies that shader attribute attPos
should read its data from the bound buffer, interpreting each vertex attributes as a four-component floating-point vector.
This tells the GPU how to fetch and interpret vertex data from the buffer during rendering.