Computer Graphics Lab

Course Information

  • Semester: 8th
  • Course Code: CSE-4208
  • Credits: 01
  • Course Teacher: Md Habibul Basar Faruq
  • Email: mh.faruq06@gmail.com

Lab Objectives

  • Implement and visualize basic computer graphics algorithms.
  • Apply 2D and 3D transformations and projection techniques.
  • Explore clipping, shading, texture mapping, and animation.
  • Gain hands-on experience with OpenGL/GLUT for interactive graphics.
  • Develop simple real-time graphics applications.

Expected Outcomes

By the end of this lab, students will be able to:

  • Write and execute programs to draw primitives and apply transformations.
  • Implement algorithms for clipping, filling, and hidden-surface removal.
  • Create interactive applications using OpenGL.
  • Design mini projects with real-time rendering and animation.

Weekly Activities

  • Week 1: Introduction to Graphics Programming

    • Install OpenGL and GLUT/GLFW.
    • Write a basic OpenGL program to display a window.
    • Understand viewport and coordinate systems.
  • Week 2: Line Drawing Algorithms

    • Implement DDA (Digital Differential Analyzer) algorithm.
    • Implement Bresenham’s line drawing algorithm.
    • Compare efficiency of both methods.
  • Week 3: Circle and Ellipse Drawing

    • Implement midpoint circle algorithm.
    • Implement midpoint ellipse drawing algorithm.
    • Display multiple circles/ellipses in different positions.
  • Week 4: Polygon Drawing and Filling

    • Draw polygons using OpenGL primitives.
    • Implement scan-line polygon filling algorithm.
    • Apply boundary-fill and flood-fill techniques.
  • Week 5: 2D Geometric Transformations

    • Apply translation, scaling, rotation on 2D objects.
    • Implement shear and reflection transformations.
    • Perform composite transformations using matrices.
  • Week 6: 3D Geometric Transformations

    • Apply translation, scaling, rotation on 3D objects.
    • Demonstrate rotation about arbitrary axes.
    • Visualize cube or pyramid with transformations.
  • Week 7: Viewing and Clipping

    • Implement Cohen–Sutherland line clipping algorithm.
    • Implement Liang–Barsky line clipping.
    • Apply Sutherland–Hodgman polygon clipping.
  • Week 8: Hidden Surface Removal

    • Implement Z-buffer algorithm for hidden-surface removal.
    • Render multiple overlapping objects.
  • Week 9: Lighting and Shading

    • Apply ambient, diffuse, and specular lighting.
    • Implement flat shading and Gouraud shading using OpenGL.
    • Compare shading effects on 3D models.
  • Week 10: Texture Mapping

    • Apply 2D textures to polygons.
    • Implement texture filtering (nearest, linear).
    • Create a simple textured cube or wall.
  • Week 11: Introduction to Ray Tracing

    • Write a simple ray tracing program for spheres and planes.
    • Implement reflection for shiny surfaces.
  • Week 12: Animation

    • Implement keyframe animation for an object.
    • Create simple 2D/3D motion (e.g., rotating windmill, bouncing ball).
  • Week 13: Shader Programming

    • Introduction to GLSL shaders.
    • Write vertex and fragment shaders for color manipulation.
    • Implement Phong shading using shaders.
  • Week 14: Mini Project Development

    • Students work on assigned projects integrating multiple concepts.
    • Example projects: Solar system model, 3D house design, simple game scene.
  • Week 15: Project Presentation and Viva

    • Demonstration of project.
    • Oral examination based on implemented techniques.

Assessment Components

  • Lab Assignments: 40%
  • Attendance and Participation: 10%
  • Mini Project: 40%
  • Viva/Presentation: 10%

Tools and References

  • Programming Languages: C/C++ or Python
  • APIs: OpenGL, GLUT/GLFW
  • Shader Language: GLSL
  • Recommended Books:
    • Computer Graphics: Principles and Practice – Foley et al.
    • Interactive Computer Graphics – Edward Angel
  • Online Resources: