2D Game Development 2D Rendering and Graphics 1 — Questions and Answers
Question 1: What is a 'draw call' in 2D game rendering?
- A command sent to the GPU to render a batch of geometry (Correct answer)
- A function that draws a sprite in code
- A scheduled rendering task
- A call to load a texture from disk
Correct answer: A command sent to the GPU to render a batch of geometry
Each draw call submits geometry and state changes to the GPU; minimizing them through batching is critical for 2D game performance.
Question 2: What is 'sprite batching' in 2D rendering?
- Combining multiple sprite draw calls that share the same texture into a single GPU call (Correct answer)
- Grouping sprites in the scene hierarchy
- Preloading all sprites at game start
- Sorting sprites by depth before rendering
Correct answer: Combining multiple sprite draw calls that share the same texture into a single GPU call
Sprite batching groups all sprites using the same texture atlas into one draw call, reducing CPU-GPU overhead and improving rendering performance.
Question 3: What is a 'shader' in 2D game graphics?
- A program running on the GPU that controls how pixels and vertices are rendered (Correct answer)
- A tool for painting sprite shadows
- A lighting calculation performed on the CPU
- A post-processing filter applied after export
Correct answer: A program running on the GPU that controls how pixels and vertices are rendered
Shaders are small GPU programs (vertex and fragment/pixel shaders) that determine how geometry is transformed and how each pixel's color is calculated.
Question 4: What is the 'painter's algorithm' in 2D rendering?
- Rendering objects from back to front so nearer objects overdraw farther ones (Correct answer)
- Painting sprites pixel by pixel
- An algorithm for generating tilemap art
- A tool for sorting sprite animation frames
Correct answer: Rendering objects from back to front so nearer objects overdraw farther ones
The painter's algorithm sorts objects by depth and draws them back-to-front so that overlapping objects appear correctly without needing a depth buffer.
Question 5: What is texture 'filtering' (bilinear vs. nearest-neighbor) in 2D games?
- Nearest-neighbor keeps pixels sharp; bilinear blends between pixels for smoother scaling (Correct answer)
- Nearest-neighbor removes texture edges; bilinear adds outlines
- Bilinear is faster than nearest-neighbor on all hardware
- Nearest-neighbor is only for 3D textures
Correct answer: Nearest-neighbor keeps pixels sharp; bilinear blends between pixels for smoother scaling
Nearest-neighbor sampling picks the closest pixel when scaling, preserving the sharp look of pixel art, while bilinear interpolation blends neighboring pixels for smoother scaling of non-pixel art.
Question 6: What is 'z-ordering' (sort order) in 2D rendering?
- Controlling the render order of sprites to determine which appears in front of others (Correct answer)
- Sorting sprites alphabetically
- Setting the z-axis position in 3D space
- Organizing layers in the project hierarchy
Correct answer: Controlling the render order of sprites to determine which appears in front of others
Z-ordering assigns a sorting value to each sprite so the renderer knows which objects to draw on top, creating correct visual layering in a flat 2D world.
What is a 'draw call' in 2D game rendering?