OpenGL OpenGL Buffers and Textures 1 — Questions and Answers
Question 1: What OpenGL object stores vertex data (positions, normals, UVs) on the GPU?
- VAO
- VBO (Correct answer)
- FBO
- RBO
Correct answer: VBO
A Vertex Buffer Object (VBO) is a buffer object allocated on the GPU that holds raw vertex attribute data.
Question 2: What is the purpose of a Vertex Array Object (VAO) in OpenGL?
- Stores raw pixel data for textures
- Records vertex attribute configurations and buffer bindings (Correct answer)
- Holds index data for element drawing
- Manages texture units
Correct answer: Records vertex attribute configurations and buffer bindings
A VAO saves the state of vertex attribute pointers and buffer bindings so the configuration can be restored with a single bind call.
Question 3: Which OpenGL function uploads vertex data from the CPU to a bound buffer object?
- glVertexAttribPointer
- glBufferData (Correct answer)
- glBindBuffer
- glEnableVertexAttribArray
Correct answer: glBufferData
glBufferData(target, size, data, usage) allocates storage for the bound buffer and optionally copies data into it.
Question 4: What texture target is used when creating and binding a standard 2D image texture in OpenGL?
- GL_TEXTURE_1D
- GL_TEXTURE_CUBE_MAP
- GL_TEXTURE_2D (Correct answer)
- GL_TEXTURE_3D
Correct answer: GL_TEXTURE_2D
GL_TEXTURE_2D is the target for standard two-dimensional images, the most common texture type in OpenGL.
Question 5: What does the GL_ELEMENT_ARRAY_BUFFER target store?
- Per-vertex attribute data
- Index data for indexed drawing commands (Correct answer)
- Uniform block data
- Texture coordinates only
Correct answer: Index data for indexed drawing commands
GL_ELEMENT_ARRAY_BUFFER holds integer index data used by glDrawElements to specify which vertices to draw.
Question 6: Which function specifies how a texture should be sampled when the texture is smaller than the screen area it covers (magnification)?
- glTexParameteri with GL_TEXTURE_MIN_FILTER
- glTexParameteri with GL_TEXTURE_MAG_FILTER (Correct answer)
- glGenerateMipmap
- glTexImage2D
Correct answer: glTexParameteri with GL_TEXTURE_MAG_FILTER
GL_TEXTURE_MAG_FILTER controls the magnification filter, typically set to GL_LINEAR or GL_NEAREST.
What OpenGL object stores vertex data (positions, normals, UVs) on the GPU?