Question: 4 . [ 2 0 points ] As discussed in the class, the following code sends the position and color of three vertices ( forming
points As discussed in the class, the following code sends the position and color of three vertices forming a triangle to the GPU and sets up attributes position and color
void SendData
GLfloat vertsPos
fff
fff
fff
;
glGenBuffers &vpbufferiD;
glBindBufferGLARRAYBUFFER, vpbufferID;
glBufferDataGLARRAYBUFFER, sizeofvertsPos vertsPos, GLSTATICDRAW;
glEnableVertexAttribArray;
GLfloat vertsCol
fff
fff
fff
;
glGenBuffers &vcbufferlD;
glBindBufferGLARRAYBUFFER, vcbufferID;
glBufferDataGLARRAYBUFFER, sizeofvertsCol vertsCol, GLSTATICDRAW;
glEnableVertexAttribArray;
The Display function below will then draw a triangle with the provided position and color on the screen.
void Display
glBindBufferGLARRAYBUFFER, vpbufferID;
glVertexAltribPointer GLFLOAT, GLFALSE, ;
glBindBufferGLARRAYBUFFER, vcbufferID;
glVertexAttribPointer GLFLOAT, GLFALSE, ;
gIDrawArraysGLTRIANGLES, ;
Now let's say we change the Display code as follows. Note that the only difference is that the glBindBuffer functions are removed.
void Display
gIVertexAltribPointer GLFLOAT, GLFALSE, ;
glVertexAttribPointer GLFLOAT, GLFALSE, ;
glDrawArraysGLTRIANGLES, ;
a points Explain what happens in this case. Which arrays will be assigned to attributes position and color
b points Draw the outcome inside the orange box. Make sure you indicate the color of each vertex.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
