2021BCS0103 CSE411 Lab5
2021BCS0103 CSE411 Lab5
Name-S.Vaishnavi Reddy
Roll no-2021BCS0103
Batch-1
Q) Fill a rhombus using scanline polygon
filling algorithm.
Code:
#include <windows.h>
#include <GL/glut.h>
#include <iostream>
#include <vector>
#include <algorithm>
intersections.push_back(static_cast<int>(x));
}
}
// Main function
int main(int argc, char** argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE |
GLUT_RGB); // Single buffering and RGB color
mode
glutInitWindowSize(400, 400); //
Set window size
glutInitWindowPosition(100, 100); //
Set window position on screen
glutCreateWindow("Drawing Rhombus
using Centered Scanline Polygon Fill
Algorithm"); // Create window with title
init(); // Initialize
OpenGL settings
glutDisplayFunc(display); // Set
the display callback for when window needs
to be redrawn
glutMainLoop(); // Start the
main event loop
return 0;
}
Output