This is an assignment of "Drawing of Togo National Flag in C++ by using OpenGL."
If there is anything wrong, then you will see forgiveness.
Thank you...
1. Assignment
Drawing of Togo National Flag in C++ by using OpenGL
Submitted by
Name : SH Rajøn
Batch : 1410
Student of Department of Computer Science and Engineering 0f IUBAT
IUBAT- International University of Business Agriculture and Technology
Date : 25/07/2018
2.
3. Figure: Togo National Flag
In this flag there are five primitives are used. Three of them is Quad,one is triangle
and another one is polygon.
Assignment’s Description:
This Computer Graphics Assignments as mentioned above draw Flag of Togo.
As we can see in the Assignments output image above. In this Assignment, there is
no user interaction as well as the Assignment is static one. A basic OpenGL
program has included header files, global variable declaration, draw function, init
function and main function. This program has only these basic functions, since it
not required having anything else. Just draw the primitives to give a propershape
of flag.
4. Drawing Function for Geometrical Primitives:
For drawing this flag, we need only five geometrical primitives, three of them is
quad,one is triangle and another one in polygon. All objects in this Assignment is
included in draw function. As we can see the flag has four part of different color.
We have use the glBegin(GL_QUADS) to draw the quad shapes, and
glBegin(GL_TRIANGLES) is use to draw the triangle and
glBegin(GL_POLYGON) is used to draw the polygon.
First Primitives (1stQuad):
Here is the graph for first primitive of that flag
5. Codefor this primitive:
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.180, 0.545, 0.341);
glBegin(GL_QUADS);
glVertex2d(30.0,17.0);
glVertex2d(30.0,-2.0);
glVertex2d(-30.0,-2.0);
glVertex2d(-30.0,17.0);
glEnd();
glFlush();
SecondPrimitive (2nd Quad):
Here is the graph for Second primitive of the flag
6. Codefor this primitive:
glColor3f(1.000, 0.843, 0.000);
glBegin(GL_QUADS);
glVertex2d(30.0,11.0);
glVertex2d(30.0,-10.0);
glVertex2d(-30.0,-10.0);
glVertex2d(-30.0,11.0);
glEnd();
glFlush();
Third Primitive (3rd
Quad):
Here is the graph for Third primitive of the flag
7. Codefor this primitive:
glColor3f(0.180, 0.545, 0.341);
glBegin(GL_QUADS);
glVertex2d(30.0,5.0);
glVertex2d(30.0,-2.0);
glVertex2d(-30.0,-2.0);
glVertex2d(-30.0,5.0);
glEnd();
glFlush();
Fourth Primitive (4th
Quad):
Here is the graph for Third primitive of the flag
8. Codefor this primitive:
glColor3f(0.180, 0.545, 0.341);
glBegin(GL_QUADS);
glVertex2d(30.0,-8.0);
glVertex2d(30.0,-13.0);
glVertex2d(-30.0,-13.0);
glVertex2d(-30.0,-8.0);
glEnd();
glFlush();
Fifth Primitive (5th
Quad):
Here is the graph for Third primitive of the flag
9. Codefor this primitive:
glBegin(GL_QUADS);
glColor3f(0.863, 0.078, 0.235);
glVertex2f(-30.0f, 17.0f);
glVertex2f( -5.5f, 17.0f);
glVertex2f( -5.5f, -2.0f);
glVertex2f(-30.0f, -2.0f);
glEnd();
Sixth Primitive (1stTriangle):
Here is the graph for fourth primitive of the flag