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.
✅ 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.
- Install Turbo C++
Make sure Turbo C++ is installed andBGI
drivers are available at: C:\TURBOC3\BGI - Open the IDE
- Load the desired
.cpp
file - Compile and Run
Note: These programs are designed for DOS-based Turbo C++. They *won’t run in modern compilers without adapting graphics.h
.
Each program folder contains:
- The
.cpp
source file - A detailed
README.md
explaining: - What the program does
- How it works
- Sample output
- Concepts demonstrated
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.
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.