Skip to content

Computer Graphics programs in C++ with graphics.h, covering DDA, Circle Drawing, Clipping, and 3D shapes. Educational examples for B.Tech coursework.

License

Notifications You must be signed in to change notification settings

harshladha/ComputerGraphics-Code-Bank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ComputerGraphics-Code-Bank

This repository contains a collection of Computer Graphics programs implemented in C++ using the Turbo C++ environment (graphics.h). These were created as part of my B.Tech 4th Semester coursework and include essential algorithms and demonstrations.


📚 Programs Included

1. DDA Line Drawing

  • Draws a line between two points using the Digital Differential Analyzer algorithm.

2. Midpoint Circle Drawing

  • Draws a circle using the Midpoint Circle Algorithm and fills it.

3. Line Clipping

  • Implements line clipping logic inspired by the Cohen-Sutherland algorithm.

4. Polygon Clipping

  • Demonstrates visual polygon clipping within a rectangular window.

5. Smiley Face

  • Uses basic shapes to draw a smiley face.

6. Single Pixel and Pre-Specified Pattern

  • Shows how to plot pixels and draw primitive shapes.

7. 3D Bar

  • Draws a 3D bar using user-input transformation matrix elements.

🛠️ How to Compile and Run

💻 Turbo C++ (Windows)

  1. Install Turbo C++
    Make sure Turbo C++ is installed and BGI drivers are available at: C:\TURBOC3\BGI
  2. Open the IDE
  3. Load the desired .cpp file
  4. Compile and Run

Note: These programs are designed for DOS-based Turbo C++. They *won’t run in modern compilers without adapting graphics.h.


✨ Screenshots & Outputs

Each program folder contains:

  • The .cpp source file
  • A detailed README.md explaining:
  • What the program does
  • How it works
  • Sample output
  • Concepts demonstrated

🚀 Roadmap to Learn Computer Graphics

If you’re new to graphics programming, here’s a suggested learning path (aligned with this repo):

1️⃣ Drawing Basics

  • putpixel()
  • Drawing simple shapes (circle(), rectangle(), line())

2️⃣ Line Drawing Algorithms

  • DDA Line Drawing
  • Bresenham's Line Algorithm (optional)

3️⃣ Circle Drawing

  • Midpoint Circle Algorithm

4️⃣ Polygon Clipping

  • Concept of clipping windows
  • Cohen-Sutherland Algorithm logic

5️⃣ 3D Bar Rendering

  • Using bar3d() for 3D effects

6️⃣ Combining Primitives

  • Drawing patterns, smiley faces, etc.

🙌 Credits

These programs were written as part of my Computer Graphics coursework (4th Semester B.Tech).

Feel free to fork, modify, or use them for educational purposes.


📄 License

MIT License

About

Computer Graphics programs in C++ with graphics.h, covering DDA, Circle Drawing, Clipping, and 3D shapes. Educational examples for B.Tech coursework.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages