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