OpenGL OpenGL Buffers and Textures 2 — Questions and Answers
Question 1: What is a Framebuffer Object (FBO) used for in OpenGL?
- Storing vertex indices
- Rendering to off-screen textures or renderbuffers (Correct answer)
- Uploading uniform data
- Managing shader programs
Correct answer: Rendering to off-screen textures or renderbuffers
An FBO lets you redirect rendering output to textures or renderbuffers instead of the default on-screen framebuffer.
Question 2: What OpenGL function generates mipmaps for the currently bound texture?
- glTexStorage2D
- glGenerateMipmap (Correct answer)
- glTexSubImage2D
- glBindTexture
Correct answer: glGenerateMipmap
glGenerateMipmap(target) automatically builds all mipmap levels for the texture currently bound to target.
Question 3: Which OpenGL usage hint indicates that buffer data will be set once and drawn many times?
- GL_DYNAMIC_DRAW
- GL_STREAM_DRAW
- GL_STATIC_DRAW (Correct answer)
- GL_READ_ONLY
Correct answer: GL_STATIC_DRAW
GL_STATIC_DRAW tells the driver to optimize for data uploaded once and used repeatedly for drawing.
Question 4: What OpenGL function is used to define how vertex attribute data is interpreted from a bound VBO?
- glVertexAttribPointer (Correct answer)
- glBindVertexArray
- glBufferData
- glEnableVertexAttribArray
Correct answer: glVertexAttribPointer
glVertexAttribPointer specifies the size, type, stride, and offset of a vertex attribute within the currently bound VBO.
Question 5: Which internal format provides a 32-bit floating-point depth attachment for a framebuffer?
- GL_DEPTH_COMPONENT16
- GL_DEPTH_COMPONENT24
- GL_DEPTH_COMPONENT32F (Correct answer)
- GL_RGBA32F
Correct answer: GL_DEPTH_COMPONENT32F
GL_DEPTH_COMPONENT32F allocates a 32-bit float depth buffer, giving maximum depth precision.
Question 6: What is the role of texture wrapping parameters such as GL_REPEAT and GL_CLAMP_TO_EDGE?
- Control mipmap generation quality
- Define how textures behave when UV coordinates go outside [0, 1] (Correct answer)
- Set the texture compression format
- Determine the number of texture units
Correct answer: Define how textures behave when UV coordinates go outside [0, 1]
Wrapping parameters determine whether texture coordinates outside [0,1] tile the texture, mirror it, or clamp to the border.
What is a Framebuffer Object (FBO) used for in OpenGL?