This directory contains all the relevant lab programs from the course Computer Graphics. This is meant to serve an a beginner's guide to OpenGL in C++ and implement the standard Graphic processing and rendering algorithms. You can find the screenshots of running all the binaries in the images directory.
All the source code files are located in the programs
directory, and the root level binaries
directory is for the complied binaries generated from the source code.
To compile a source code file, use the following command:
g++ programs/FileName.cpp -o binaries/FileName -lglut -lGLU -lGL
This will create a file called FileName
in the binaries
directory. You can execute the same by executing the following:
./binaries/FileName
For the purposes of this repository, I would not be commiting the binaries
folder.
You can compile all the binaries in one go by using the shell script.
chmod +x compile.sh
./compile.sh
S.No. | Name | Description |
---|---|---|
1 | Introduction | Generates a simple triangle |
2 | DDA | Line generation usind DDA |
3 | Bresenham's Algorithm | Line generation using Bresenham's Algorithm |
4 | Dotted Line Generation | Dotted line generation using Bresenham's Algorithm |
5 | Circle Generation: Parametric | Circle generation using the paramteric representation of a circle |
6 | Circle Generation: Polynomial | Circle generation using the polynomial representation of a circle |
7 | Circle Generation: Breshenham | Circle generation using Breshenham's algorithm |
8 | Circle Generation: Midpoint | Circle generation using the midpoint analysis technique |
9 | Ellipse Generation: Parametric | Ellopse generation using the paramteric representation of a circle |
10 | Ellipse Generation: Polynomial | Ellipse generation using the polynomial representation of a circle |
11 | Ellipse Generation: Midpoint | Ellipse generation using the midpoint analysis technique |
12 | Scanline Polygon Filling | Filling colour in a polygon based on the scanline algorithm |
13 | Floodfill Algorithm | Implement the floodfill algorithm |
14 | Boundary Fill Algorithm | Implement the boundary fill algorithm |
15 | Simple Geometric Transformations | Implement translation, scaling, rotation, reflection and shearing algorithms for a triangle |
16 | Reflection about Line | Implement reflection of a trinagle about a line using simple geometric transformations |
17 | Scaling and Rotation about a Point | Implement rotation and scaling of a trinagle about a point using simple geometric transformations |
18 | Window Viewport Transformation | Implement window and viewport transformation algorithm, and use the inbuilt OpenGL functions to demonstrate the same on a house. |
19 | 3D Simple Transformations | Implement translation, scaling, rotation, reflection and shearing algorithms in 3D coordinates |
20 | 3D Composite Transformations | Rotate a cube about an arbitary line in the 3D coordinate system |
21 | 3D Composite Transformations 2 | Rotate a cube about a line parallel to the X axis in the 3D coordinate system |
22 | Perspective Projection | Project a cube onto a 2D plane using perspective projection |
23 | Parallel Projection | Project a cube onto a 2D plane using parallel projection |
24 | Cohen Sutherland Clipping | Demonstrate the Cohen Sutherland 2D Clipping algorithm. After entering the coordinates, press 'C' on keyboard to perform clipping. |
25 | Cyrus Beck Clipping | Demonstrate Cryus Beck 2D Clipping algorithm for a rectangular window. After entering the coordinates, press 'C' on keyboard to perform clipping. |
26 | Liang Barsky Clipping | Demonstrate Liang Barsky Clipping algorithm for a rectangular window. After entering the coordinates, press 'C' on keyboard to perform clipping. |
27 | Polygon Clipping | Demonstrate Polygon Clipping algorithm for a quadilateral. After entering the coordinates, press 'C' on keyboard to perform clipping. |
28 | 3D Cyrus Beck Clipping | Demonstrate Cryus Beck 3D Clipping algorithm for a cuboidal window. After entering the coordinates, press 'C' on keyboard to toggle clipping, 'O' to start animation and 'P' to pause the animation. |
29 | Hermite Curve | Demonstrate Hermite's algorithm for curve generation by creating an interactive Hermite curve with 4 draggable control points |
30 | Bezier Curve | Demonstrate Bezier's algorithm for curve generation by creating an interactive Bezier curve with 4 draggable control points |
31 | Z Buffer Algorithm | Demonstrate the Z Buffer algorithm for hidden surface elimination |
32 | Scanline Z Buffer Algorithm | Demonstrate the Scanline Z Buffer algorithm for hidden surface elimination |
33 | A Buffer Algorithm | Demonstrate the A Buffer algorithm for hidden surface elimination |