This repository contains my assignments for the course Computer Graphics (2DT904). The course covers both theoretical aspects of the graphics pipeline and practical programming using OpenGL.
- Focus: Homogeneous transformations, per-triangle data, and visibility algorithms.
- Topics covered:
- Translation & rotation using 4×4 matrices
- Mapping between coordinate spaces
- Per-triangle vs. per-vertex data
- Visibility determination: Z-buffer, frustum culling, backface culling
- Deliverable: Solution PDF
- Focus: Rasterization and fragment processing in the rendering pipeline.
- Topics covered:
- Pixel inclusion using edge functions
- Color interpolation with barycentric coordinates
- Phong lighting model (ambient + diffuse)
- Texture sampling: nearest and bilinear filtering
- UV mapping
- Deliverable: Solution PDF
This assignment consisted of implementing two interactive OpenGL programs.
- Animated solar system with:
- A sun in the center
- Four planets in orbit
- A moon orbiting the third planet
- Features:
- Different colors, sizes, and angular velocities
- Ambient, diffuse, and specular lighting
- Local rotation of planets
- Camera controls with keyboard/mouse interaction
- Implementation: SolarSystem.py + sphere.py
- Visualization of 50 datapoints (
[x, y, weight]) in a 2D graph. - Features:
- Points scaled by weight
- Grayscale coloring based on data weight
- Automatic coordinate normalization to viewport
- Circles rendered with center markers
- Implementation: DataVisualization.py + datapoints.py
- Python 3.10+
- PyOpenGL
- GLFW
- NumPy
Install dependencies:
pip install PyOpenGL glfw numpy