OpenGL Certification Exam — Questions and Answers
Question 1: Which per-fragment operation runs after blending and writes or discards the final color to the framebuffer?
- Stencil op
- Depth test
- Color masking (glColorMask) (Correct answer)
- Scissor test
Correct answer: Color masking (glColorMask)
glColorMask(r, g, b, a) selectively prevents writes to specific color channels even after blending is computed.
Question 2: In OpenGL, matrices are stored in which memory order?
- Interleaved order
- Column-major order (Correct answer)
- Row-major order
- Diagonal order
Correct answer: Column-major order
OpenGL uses column-major storage, so the first four floats of a mat4 represent the first column, not the first row.
Question 3: What is the purpose of the depth test in OpenGL?
- Blends transparent fragments together
- Removes duplicate texture samples
- Ensures fragments closer to the camera overwrite farther ones (Correct answer)
- Converts normals to depth values
Correct answer: Ensures fragments closer to the camera overwrite farther ones
The depth test compares each fragment's z value against the depth buffer, keeping only the closest fragment per pixel.
Question 4: What OpenGL object stores vertex data (positions, normals, UVs) on the GPU?
- VAO
- FBO
- RBO
- VBO (Correct answer)
Correct answer: VBO
A Vertex Buffer Object (VBO) is a buffer object allocated on the GPU that holds raw vertex attribute data.
Question 5: What does the GLSL discard statement do in a fragment shader?
- Resets uniform values
- Prevents the fragment from being written to the framebuffer (Correct answer)
- Discards all vertex data
- Ends the current draw call
Correct answer: Prevents the fragment from being written to the framebuffer
discard terminates the fragment shader and drops the fragment so it does not update the framebuffer.
Question 6: Which OpenGL function maps a buffer object's data store to the CPU's address space?
- glBufferData
- glBindBuffer
- glMapBuffer (Correct answer)
- glCopyBufferSubData
Correct answer: glMapBuffer
glMapBuffer(target, access) returns a pointer to the buffer's GPU memory, allowing direct CPU read/write.
Question 7: What is the function of the lookAt matrix construction (e.g., glm::lookAt)?
- Applies rotation to bones
- Converts screen coordinates to world space
- Computes a perspective frustum
- Builds a view matrix oriented toward a target point (Correct answer)
Correct answer: Builds a view matrix oriented toward a target point
lookAt constructs a view matrix that positions the camera at 'eye', oriented toward 'center', with 'up' defining roll.
Question 8: What is the effect of calling glEnable(GL_CULL_FACE) with the default cull face setting?
- Back-facing triangles are discarded (Correct answer)
- Front-facing triangles are discarded
- No faces are discarded until glCullFace() is called
- Both front and back faces are discarded
Correct answer: Back-facing triangles are discarded
By default, glEnable(GL_CULL_FACE) discards back-facing triangles because the default cull face is GL_BACK.
Question 9: How can one revolve about a location other than the origin?
- Translate to origin, rotate about origin, then translate back to original position (Correct answer)
- Rotations can only be performed around the origin
- Perform a glRotate and specify the point to rotate around
Correct answer: Translate to origin, rotate about origin, then translate back to original position
Rotation matrices inherently spin objects around the origin, so to rotate around any other point you translate the object so that point lands on the origin, perform the rotation, then translate back to its original location. The claim that rotations can only happen around the origin is false, and simply specifying a point in glRotate does not change that — glRotate always rotates about the origin along the given axis.
Question 10: What does the GLSL uniform qualifier indicate?
- A read-only texture sampler
- A variable shared between vertex and fragment shaders via interpolation
- A constant value set from the CPU that is the same for all shader invocations in a draw call (Correct answer)
- A variable that changes per vertex
Correct answer: A constant value set from the CPU that is the same for all shader invocations in a draw call
Uniform variables are set once from application code via glUniform*() and remain constant throughout all shader invocations in a single draw call.
Question 11: What is transform feedback in OpenGL?
- Sending camera transforms back to the CPU
- Capturing vertex or geometry shader outputs into buffer objects for reuse (Correct answer)
- Feedback from the driver on vertex cache efficiency
- Transmitting shader compile errors to the application
Correct answer: Capturing vertex or geometry shader outputs into buffer objects for reuse
Transform feedback writes the outputs of the vertex or geometry shader into buffer objects, enabling GPU-side particle systems and simulations.
Question 12: Which of these describes an orthographic projection matrix?
- Maps NDC z values non-linearly
- Applies a fisheye lens distortion
- Creates the illusion of depth by shrinking distant objects
- Projects all vertices along parallel lines with no perspective foreshortening (Correct answer)
Correct answer: Projects all vertices along parallel lines with no perspective foreshortening
Orthographic projection preserves parallel lines and sizes regardless of depth, commonly used in CAD and 2D UI rendering.
Question 13: Which matrix converts a flat frustum-shaped view volume to a cube for perspective rendering?
- Perspective projection matrix (Correct answer)
- Scale matrix
- Orthographic projection matrix
- View matrix
Correct answer: Perspective projection matrix
A perspective projection matrix applies the 1/z depth foreshortening that makes distant objects appear smaller.
Question 14: Which GLSL qualifier marks a fragment shader output variable that writes to a color attachment?
- uniform
- in
- varying
- out (Correct answer)
Correct answer: out
Fragment shader output variables declared with 'out' are written to the corresponding framebuffer color attachment.
Question 15: What GLSL built-in function returns the dot product of two vectors?
- normalize()
- cross()
- dot() (Correct answer)
- reflect()
Correct answer: dot()
The GLSL dot(genType x, genType y) function computes the scalar dot product of two vectors.
Question 16: Which function checks whether a specific OpenGL extension is available?
- glGetString(GL_EXTENSIONS) (Correct answer)
- glIsEnabled()
- glQueryExtension()
- glewIsSupported()
Correct answer: glGetString(GL_EXTENSIONS)
glGetString(GL_EXTENSIONS) returns a space-separated string of all supported extension names (in legacy contexts).
Question 17: What does the stencil buffer allow OpenGL to do?
- Cache vertex shader outputs
- Improve texture sampling quality
- Store floating-point lighting values per pixel
- Mask rendering to specific screen regions based on per-pixel stencil values (Correct answer)
Correct answer: Mask rendering to specific screen regions based on per-pixel stencil values
The stencil buffer stores an integer value per pixel and tests can accept or reject fragments based on those values.
Question 18: What OpenGL blending equation produces standard over-compositing for transparent objects?
- GL_ONE, GL_ZERO
- GL_ONE, GL_ONE
- GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA (Correct answer)
- GL_DST_COLOR, GL_SRC_COLOR
Correct answer: GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) blends source and destination by the fragment's alpha, the standard transparency blend.
Question 19: Which OpenGL primitive type draws a separate triangle for every 3 vertices submitted?
- GL_TRIANGLES (Correct answer)
- GL_QUADS
- GL_TRIANGLE_FAN
- GL_TRIANGLE_STRIP
Correct answer: GL_TRIANGLES
GL_TRIANGLES treats each consecutive group of three vertices as an independent triangle, with no sharing.
Question 20: What does the OpenGL compute shader stage provide that other shader stages do not?
- General-purpose GPU computation outside the fixed graphics pipeline (Correct answer)
- Hardware tessellation of patches
- Instanced rendering
- Multi-sample rasterization
Correct answer: General-purpose GPU computation outside the fixed graphics pipeline
Compute shaders run independently of the vertex/fragment pipeline, enabling GPGPU tasks like physics, image processing, and AI inference.
Question 21: What is the purpose of a projection matrix in the OpenGL pipeline?
- Maps eye-space coordinates to clip space, defining the view frustum (Correct answer)
- Applies lighting calculations
- Converts clip space to NDC
- Converts object space to world space
Correct answer: Maps eye-space coordinates to clip space, defining the view frustum
The projection matrix encodes perspective or orthographic projection, mapping the view frustum to the canonical clip volume.
Question 22: What OpenGL function swaps the front and back buffers to display the completed frame?
- glPresent
- glFlush
- glFinish
- SwapBuffers (platform API) (Correct answer)
Correct answer: SwapBuffers (platform API)
Buffer swapping is a platform-level operation (e.g., SDL_GL_SwapWindow or SwapBuffers on Windows) not an OpenGL core function.
Question 23: What does the OpenGL function glDrawArraysInstanced do?
- Draws a single mesh multiple times with per-instance data using a single draw call (Correct answer)
- Draws multiple meshes from different VAOs
- Renders using indices stored in a buffer
- Issues a compute shader dispatch
Correct answer: Draws a single mesh multiple times with per-instance data using a single draw call
glDrawArraysInstanced renders the same geometry 'primcount' times, allowing per-instance variation via gl_InstanceID in the shader.
Question 24: Who used computer graphics for the first time?
- William Fetter (Correct answer)
- Nicholas Williams
- Ivan Edward Sutherland
- Ada Lovelace
Correct answer: William Fetter
Explanation: <br> William Fetter created cockpit drawings in the 1960s using computer graphics. He conducted research on computer graphics alongside Verne Hudson.
Question 25: What rotation representation avoids gimbal lock and is commonly used in 3D graphics for smooth interpolation?
- Quaternions (Correct answer)
- Rotation matrices
- Axis-angle
- Euler angles
Correct answer: Quaternions
Quaternions represent rotations in a compact 4D form that supports smooth SLERP interpolation without gimbal lock.
Question 26: What OpenGL function is used to compile a shader object?
- glShaderSource
- glCompileShader (Correct answer)
- glAttachShader
- glLinkProgram
Correct answer: glCompileShader
glCompileShader(shader) compiles the GLSL source code that was previously loaded with glShaderSource.
Question 27: What OpenGL test discards fragments whose alpha value falls below a threshold?
- Depth test
- Scissor test
- Alpha test (via discard in GLSL) (Correct answer)
- Stencil test
Correct answer: Alpha test (via discard in GLSL)
In core OpenGL, alpha testing is implemented manually in the fragment shader by calling discard when alpha is below a threshold.
Question 28: Which OpenGL function must be called after modifying the currently bound VAO to enable a vertex attribute index?
- glActiveTexture
- glVertexAttribPointer
- glBindAttribLocation
- glEnableVertexAttribArray (Correct answer)
Correct answer: glEnableVertexAttribArray
glEnableVertexAttribArray(index) activates the generic vertex attribute at the given index so it supplies data during draws.
Question 29: What is a renderbuffer object (RBO) typically used for compared to a texture attachment in an FBO?
- RBOs support mipmap levels; textures do not
- RBOs can be shared across contexts; textures cannot
- RBOs hold vertex data; textures hold color data
- RBOs are optimized for off-screen render targets that will not be sampled as textures (Correct answer)
Correct answer: RBOs are optimized for off-screen render targets that will not be sampled as textures
Renderbuffers are write-only storage optimized by drivers for use as depth/stencil attachments when shader sampling is not needed.
Question 30: What OpenGL query object type measures the time taken by the GPU to execute a range of commands?
- GL_SAMPLES_PASSED
- GL_TIME_ELAPSED (Correct answer)
- GL_PRIMITIVES_GENERATED
- GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN
Correct answer: GL_TIME_ELAPSED
A GL_TIME_ELAPSED query wraps GPU commands and returns the elapsed GPU time in nanoseconds, useful for profiling.
Question 31: Which texture format stores only a single channel of floating-point data in OpenGL?
- GL_RGB32F
- GL_DEPTH_COMPONENT
- GL_LUMINANCE
- GL_R32F (Correct answer)
Correct answer: GL_R32F
GL_R32F is a single-channel 32-bit floating-point internal texture format, useful for heightmaps, AO maps, or any scalar data.
Question 32: What does the glViewport function define in OpenGL?
- The rectangular window area on screen that NDC maps to (Correct answer)
- The field of view for the projection
- The depth range for the depth buffer
- The camera's position
Correct answer: The rectangular window area on screen that NDC maps to
glViewport(x, y, width, height) sets the pixel region on the window where NDC space (-1 to 1) is mapped.
Question 33: What GLSL built-in variable gives the index of the current vertex in a draw call?
- gl_PrimitiveID
- gl_InstanceID
- gl_VertexID (Correct answer)
- gl_DrawID
Correct answer: gl_VertexID
gl_VertexID contains the index of the current vertex, useful for procedurally generating per-vertex data.
Question 34: Which function specifies how a texture should be sampled when the texture is smaller than the screen area it covers (magnification)?
- glGenerateMipmap
- glTexParameteri with GL_TEXTURE_MAG_FILTER (Correct answer)
- glTexImage2D
- glTexParameteri with GL_TEXTURE_MIN_FILTER
Correct answer: glTexParameteri with GL_TEXTURE_MAG_FILTER
GL_TEXTURE_MAG_FILTER controls the magnification filter, typically set to GL_LINEAR or GL_NEAREST.
Question 35: Which OpenGL function sets the depth range mapping from NDC z to window z?
- glClearDepth
- glDepthMask
- glScissor
- glDepthRange (Correct answer)
Correct answer: glDepthRange
glDepthRange(near, far) remaps the NDC z range [-1, 1] to a custom window-space depth range, defaulting to [0, 1].
Question 36: What does the GL_ELEMENT_ARRAY_BUFFER target store?
- Texture coordinates only
- Uniform block data
- Per-vertex attribute data
- Index data for indexed drawing commands (Correct answer)
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 37: In OpenGL 4.6, what functionality was added from SPIR-V support?
- Hardware ray tracing API
- Support for DirectX HLSL shaders
- Mesh shaders
- Ability to load precompiled SPIR-V shader binaries directly (Correct answer)
Correct answer: Ability to load precompiled SPIR-V shader binaries directly
OpenGL 4.6 incorporated ARB_gl_spirv, allowing applications to upload SPIR-V bytecode as shader source via glShaderBinary.
Question 38: What transformation decomposes a model matrix rotation into individual axes?
- Quaternion slerp
- SVD
- Polar decomposition
- Euler angle extraction (Correct answer)
Correct answer: Euler angle extraction
Euler angle extraction decomposes a rotation matrix into three successive rotations around the X, Y, and Z axes.
Question 39: What is the role of texture wrapping parameters such as GL_REPEAT and GL_CLAMP_TO_EDGE?
- Control mipmap generation quality
- Determine the number of texture units
- Define how textures behave when UV coordinates go outside [0, 1] (Correct answer)
- Set the texture compression format
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.
Question 40: Which shader stage runs once per primitive and can modify or generate vertices between the vertex and fragment stages?
- Transform feedback
- Geometry shader (Correct answer)
- Tessellation shader
- Compute shader
Correct answer: Geometry shader
The geometry shader receives a complete primitive and can emit zero or more new primitives to the rasterizer.
Question 41: What OpenGL function retrieves the location of a uniform variable in a linked shader program?
- glGetUniformLocation (Correct answer)
- glGetAttribLocation
- glUniform1i
- glBindUniform
Correct answer: glGetUniformLocation
glGetUniformLocation(program, name) returns the integer location index used to set that uniform's value.
Question 42: Which of the following describes the type of computer graphics?
- Scalar only
- All of the above
- Raster and Scalar
- Raster and Vector (Correct answer)
Correct answer: Raster and Vector
Explanation: <br> Computer-generated visual art called vector graphics adheres to a mathematical formula. Raster images are perfect for photo editing since they comprise thousands of small pixels, making them resolution-dependent.
Question 43: Which GLSL version directive is required to use the core profile layout qualifiers?
- #version 330 core (Correct answer)
- #version 120
- #version 210
- #version 110
Correct answer: #version 330 core
Layout qualifiers such as 'layout(location = 0)' require at least #version 330 core in GLSL.
Question 44: What is the maximum number of texture units available to a fragment shader on most modern OpenGL hardware?
- 4
- 16
- 8
- At least 16, typically 32+ (Correct answer)
Correct answer: At least 16, typically 32+
The OpenGL spec guarantees at least 16 texture units per stage, and modern hardware typically provides 32 or more.
Question 45: Which OpenGL primitive mode draws a connected strip of triangles sharing edges?
- GL_LINE_STRIP
- GL_TRIANGLES
- GL_TRIANGLE_STRIP (Correct answer)
- GL_TRIANGLE_FAN
Correct answer: GL_TRIANGLE_STRIP
GL_TRIANGLE_STRIP reuses two vertices from the previous triangle, efficiently drawing n-2 triangles with n vertices.
Question 46: Which built-in GLSL variable holds the final position of a vertex in clip space?
- gl_FragCoord
- gl_VertexID
- gl_ClipDistance
- gl_Position (Correct answer)
Correct answer: gl_Position
The vertex shader must write the clip-space position to gl_Position for the rasterizer to use.
Question 47: 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 48: In OpenGL, what coordinate system results after dividing clip coordinates by the w component?
- Normalized Device Coordinates (NDC) (Correct answer)
- World space
- Window space
- Eye space
Correct answer: Normalized Device Coordinates (NDC)
The perspective divide (dividing x, y, z by w) converts clip coordinates to NDC, which range from -1 to +1 on each axis.
Question 49: Which language is used to write shaders in OpenGL?
- GLSL (Correct answer)
- Cg
- HLSL
- Metal
Correct answer: GLSL
OpenGL uses GLSL (OpenGL Shading Language) to write vertex, fragment, and other shader programs.
Question 50: Which internal format provides a 32-bit floating-point depth attachment for a framebuffer?
- GL_DEPTH_COMPONENT16
- GL_DEPTH_COMPONENT32F (Correct answer)
- GL_RGBA32F
- GL_DEPTH_COMPONENT24
Correct answer: GL_DEPTH_COMPONENT32F
GL_DEPTH_COMPONENT32F allocates a 32-bit float depth buffer, giving maximum depth precision.
OpenGL Certification Exam
The OpenGL Certification Exam evaluates proficiency in the OpenGL graphics API including shaders, buffers and textures, transformations and matrices, the rendering pipeline, and modern OpenGL extensions.
Exam Rules
- You can skip questions and return to them later
- Flag questions for review before submitting
- No feedback shown until you submit the entire exam
- Unanswered questions count as wrong — answer everything
- 10 pretest questions are mixed in and don't affect your score
- Timer auto-submits when time runs out
- Your progress is auto-saved every 30 seconds