CG Lab 05
CG Lab 05
CG Lab 05
Submitted To:
Md Shakil Ahmed(MSA)
Lectural
Department of CSE
Daffodil International University
Submitted by:
Name: Mir Saem Hasan
ID: 211-15-4066
Section: 59_C1
Department of CSE
Daffodil International University
Report: Bresenham's Line Drawing Algorithm in OpenGL
1. Objective
The objective of this lab is to understand and implement Bresenham's Line Drawing Algorithm
using OpenGL. The algorithm is used to efficiently draw lines on a raster display by using
integer calculations.
2.Theory:
Bresenham’s algorithm is an efficient way to draw a straight line between two points on a raster
grid. It avoids the use of floating-point arithmetic by using only integer operations, which are
faster and more suited for pixel-based screens.
Given two endpoints (x0,y0)(x_0, y_0)(x0,y0) and (x1,y1)(x_1, y_1)(x1,y1), the goal is to
determine which pixels should be plotted to form a close approximation of the line.
4. Output:
Upon running the program, a 500x500 pixel window opens displaying its Bresenham’s
algorithm.
6. Conclusion
The DDA algorithm is effective for drawing lines by incrementing coordinates based on the In
this lab, we implemented Bresenham’s Line Drawing Algorithm in OpenGL. The algorithm
allows for efficient rasterization of lines using only integer operations, making it ideal for
drawing lines on pixel-based displays. The OpenGL implementation demonstrates the practical
application of this algorithm in computer graphics.