Part IA Michaelmas Term
OpenGL Rendering Pipeline
OpenGL History
- OpenGL 1.0 (1992): Fixed-function pipeline
- OpenGL 2.0 (2004): GLSL shaders introduced
- OpenGL 3.2 (2009): Core profile, deprecated fixed-function
- OpenGL 4.5+ (2014+): Modern features, SPIR-V shaders
Programming Model
- CPU side:
gl*functions to create objects, copy data, modify state - GPU side: Shaders written in GLSL (OpenGL Shading Language)
The Rendering Pipeline
Vertex Data → Vertex Shader → Tessellation → Geometry Shader →
Primitive Assembly → Clipping → Rasterisation → Fragment Shader → Screen Buffer
Pipeline Stages
Programmable Stages
| Stage | Purpose |
|---|---|
| Vertex Shader | Transform vertices, pass attributes |
| Tessellation | Subdivide patches into triangles |
| Geometry Shader | Create/modify primitives |
| Fragment Shader | Compute pixel colours |
Fixed-Function Stages
| Stage | Purpose |
|---|---|
| Primitive Assembly | Organise vertices into primitives |
| Clipping | Remove geometry outside view frustum |
| Rasterisation | Generate fragments from primitives |
Primitive Assembly
Organise vertices into primitives (triangles, lines, points) based on drawing mode.
Clipping
Remove geometry outside the view frustum:
- Vertices outside are clipped
- Edges crossing the boundary are split
- New vertices generated at clip boundaries
Rasterisation
Generate fragments (pixel candidates) for each primitive:
- Determine which pixels are inside the triangle
- Interpolate vertex attributes using barycentric coordinates
- Output fragment positions and interpolated attributes
Summary
- OpenGL pipeline combines programmable and fixed-function stages
- Vertex shader processes individual vertices
- Fragment shader computes final pixel colours
- Rasterisation bridges vertex and fragment stages
Past Paper Questions
2024 Paper 3 Question 4: Describe the stages of the OpenGL pipeline. Which are programmable?
2023 Paper 3 Question 4: Explain what happens during rasterisation.
2022 Paper 3 Question 4: What is the purpose of primitive assembly and clipping in the pipeline?