Skip to content

Ru-Na8/Datorgrafik

Repository files navigation

Computer Graphics – Assignments (2DT904, Linnaeus University)

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.


Contents

Assignment 1 – Transformations & Visibility

  • 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

Assignment 2 – Rasterization, Interpolation & Lighting

  • 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

Programming Assignment – OpenGL Applications

This assignment consisted of implementing two interactive OpenGL programs.

Solar System

  • 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

Data Visualization

  • 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

Requirements

  • Python 3.10+
  • PyOpenGL
  • GLFW
  • NumPy

Install dependencies:

pip install PyOpenGL glfw numpy

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages