OpenGL OpenGL Extensions and Modern OpenGL 1 — Questions and Answers
Question 1: What is the purpose of the OpenGL Extension Wrangler Library (GLEW)?
- Provides a windowing and context creation API
- Loads and exposes OpenGL extension function pointers at runtime (Correct answer)
- Compiles GLSL shaders offline
- Manages GPU memory allocation
Correct answer: Loads and exposes OpenGL extension function pointers at runtime
GLEW queries the driver at startup for supported extensions and loads function pointers so they can be called by the application.
Question 2: What OpenGL version introduced Direct State Access (DSA) as a core feature?
- OpenGL 3.3
- OpenGL 4.0
- OpenGL 4.5 (Correct answer)
- OpenGL 2.1
Correct answer: OpenGL 4.5
Direct State Access became part of the OpenGL core specification in version 4.5, removing the need to bind objects before modifying them.
Question 3: Which OpenGL feature allows shaders to read and write arbitrary locations in a buffer (like a GPU-side array)?
- Uniform Buffer Objects
- Shader Storage Buffer Objects (SSBO) (Correct answer)
- Transform Feedback Buffers
- Pixel Buffer Objects
Correct answer: Shader Storage Buffer Objects (SSBO)
SSBOs (GL_SHADER_STORAGE_BUFFER) support arbitrary-length, read/write access from shaders, unlike the read-only UBO.
Question 4: What does the OpenGL compute shader stage provide that other shader stages do not?
- Hardware tessellation of patches
- General-purpose GPU computation outside the fixed graphics pipeline (Correct answer)
- Multi-sample rasterization
- Instanced rendering
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 5: How does an application check whether a specific OpenGL extension is supported?
- Attempt to call the function and catch the exception
- Check the string returned by glGetString(GL_EXTENSIONS) or use glGetStringi (Correct answer)
- Read the hardware manual
- Call glIsExtensionEnabled()
Correct answer: Check the string returned by glGetString(GL_EXTENSIONS) or use glGetStringi
glGetStringi(GL_EXTENSIONS, i) iterates supported extension strings; checking for the extension name confirms availability.
Question 6: What is the purpose of bindless textures (ARB_bindless_texture) in OpenGL?
- Allows textures to be used without uploading them to the GPU
- Provides texture handles usable in shaders without explicit texture unit binding (Correct answer)
- Removes the need for texture format conversion
- Enables textures to be shared between processes
Correct answer: Provides texture handles usable in shaders without explicit texture unit binding
Bindless textures give shaders a 64-bit handle to access textures directly, eliminating texture unit binding overhead in draw calls.
What is the purpose of the OpenGL Extension Wrangler Library (GLEW)?