Module 7 Flashcards
Is an OpenGL feature that provides methods for uploading vertex data to the video device for rendering
Vertex Buffer Objects
Provides substantial performance as data resides in the video device memory rather than the system memory.
Vertex Buffer Objects
What OpenGL constant is used to Bind a regular array data to the VBO
Group of answer choices
GL_VERTEX_ARRAY
GL_NORMAL_ARRAY
GL_ELEMENT_ARRAY_BUFFER
GL_ARRAY_BUFFER
GL_ARRAY_BUFFER
Complete the program below by copy and pasting the appropriate statements below to its right place.
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*9, trianglevertices, GL_DYNAMIC_DRAW);
glClear(GL_COLOR_BUFFER_BIT);
glUnmapBuffer(GL_ARRAY_BUFFER);
glDrawArrays(GL_TRIANGLES,0,6);
glutTimerFunc(1000,modifyTriangle,0);
glVertexPointer(3, GL_FLOAT, 0, 0);
mappedVertices = (GLfloat *) glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE);
Consider the program below wherein the display function is used on the display callback of GLUT. The program moves the triangle
void display(){
glColor4f(.16f,.72f,.08f,1.0f); triangle(); glFlush();
}
void modifyTriangle(int value){
triangleUpdate=true; mappedVertices[]+=.01f; //0 mappedVertices[]+=.01f; //3 mappedVertices[]+=.01f; //6 glutPostRedisplay();
}
void triangle(){
if(!triangleUpdate) { GLfloat trianglevertices[] = { 0.0f, .75f, 0.0f, -0.75f, 0.0f, 0.0f, 0.75f, 0.0f, 0.0f }; glGenBuffers(1, &VBOid); glBindBuffer(GL_ARRAY_BUFFER, VBOid); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(3, GL_FLOAT, 0, 0); }else{ //When for update just draw the primitive object glDrawArrays(GL_TRIANGLES,0,6); }
}
Since we will be using some advance functions of OpenGL we will be needing ________ to simplify access to extended OpenGL extensions.
GLEW
Copy ___________ where your project source code resides.
glew.cand glew32.dll (x64)
Include __________ in your project directory
glew.c
GlGenBuffers parameters
Glsizei n
Gluint* buffers
obtains n buffer identifiers from its pool of unused buffers
Glsizei n
n is the number of buffer idenifiers desired by the application
Gluint buffers
vertex array data
GL_ARRAY_BUFFER
vertex array indices
GL_ELEMENT_ARRAY_BUFFER
uploads all the array information to the graphics card memory.
glBufferData()
The data store contents will be modified once and used at most a few times.
GL_STREAM_DRAW
The data store contents will be modified once and used many times.
GL_STATIC_DRAW
The data store contents will be modified repeatedly and used many times.
GL_DYNAMIC_DRAW
Activate and specify pointer to vertex array
glEnableClientState(GL_VERTEX_ARRAY);
Include glew initialization calls before the
main loop
Map the buffer object into the client’s memory
glMapBuffer(GLenumtarget, GLenumaccess)
If GPU is still working with the buffer object, glMapBuffer() will not return until GPU finishes its job
true
After modifying the data of VBO, it must be unmapped the buffer object from the client’s memory
true
Using regular arrays is more efficient than VBO as it does not need to travel from physical memory to server memory.
false
in creating VBO we first create an array to be transferred to the systems memory.
Group of answer choices
True
False
true
What function is used for the initialization of OpenGL extensions.
glewInit()
To deallocate the buffer we use glDeleteBuff() function:
Group of answer choices
True
False
False
Using VBOs are straightforward as they are included in the GLUT library.
Group of answer choices
True
False
False
To switch back to normal operation we bind the buffer with a value of ___________.
Group of answer choices
0
2
1
3
0