SlideShare a Scribd company logo
1 of 18
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
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.
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
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
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
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
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
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
Codefor this primitive:
glColor3f(0.8,0,0);
glBegin(GL_TRIANGLES);
glVertex2d(-30.0,15.0);
glVertex2d(0.0,0.0);
glVertex2d(-30.0,-15.0);
glEnd();
glFlush();
Seventh Primitive (2nd Triangle):
Here is the graph for fourth primitive of the flag
Codefor this primitive:
glColor3f(1,1,1);
// Draw a triangle:
glBegin(GL_TRIANGLES);
// Lower left vertex
glVertex2f(-10.0f, 10.5f);
// Lower right vertex
glVertex2f( -25.0f, 10.5f);
// Upper vertex
glVertex2f(- 18.0f, 7.0f);
glEnd();
glBegin(GL_TRIANGLES);
// Lower left vertex
glVertex2f(-18.0f, 15.0f);
// Lower right vertex
glVertex2f( -13.0f, 3.0f);
// Upper vertex
glVertex2f(- 19.0f, 8.0f);
glEnd();
glBegin(GL_TRIANGLES);
// Lower left vertex
glVertex2f(-18.0f, 15.0f);
// Lower right vertex
glVertex2f( -17.0f, 8.0f);
// Upper vertex
glVertex2f(- 22.5f, 3.0f);
glEnd();
glFlush();
Code:
//Name : SH Rajøn
//ID : 1410
//Assignment Name : Flag of Togo
#include<windows.h>
#include<GL/glut.h>
void flag()
{
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();
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();
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();
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();
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();
glColor3f(1,1,1);
// Draw a triangle:
glBegin(GL_TRIANGLES);
// Lower left vertex
glVertex2f(-10.0f, 10.5f);
// Lower right vertex
glVertex2f( -25.0f, 10.5f);
// Upper vertex
glVertex2f(- 18.0f, 7.0f);
glEnd();
glBegin(GL_TRIANGLES);
// Lower left vertex
glVertex2f(-18.0f, 15.0f);
// Lower right vertex
glVertex2f( -13.0f, 3.0f);
// Upper vertex
glVertex2f(- 19.0f, 8.0f);
glEnd();
glBegin(GL_TRIANGLES);
// Lower left vertex
glVertex2f(-18.0f, 15.0f);
// Lower right vertex
glVertex2f( -17.0f, 8.0f);
// Upper vertex
glVertex2f(- 22.5f, 3.0f);
glEnd();
glFlush();
}
void Initialize()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glClearColor(.96,0.87,0.70,0.0);
glOrtho(-40, 40, -20, 20, -20, 20);
}
int main(int Argc, char** Argv)
{
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(1170,620);
glutInitWindowPosition(50,50);
glutCreateWindow("Flag of Togo");
Initialize();
glutDisplayFunc(flag);
glutMainLoop();
return 0;
}
Togo National Flag

More Related Content

Similar to Togo National Flag (20)

CS 354 Viewing Stuff
CS 354 Viewing StuffCS 354 Viewing Stuff
CS 354 Viewing Stuff
 
01.Opengl_intro-2.ppt
01.Opengl_intro-2.ppt01.Opengl_intro-2.ppt
01.Opengl_intro-2.ppt
 
Introduction to graphics programming in c
Introduction to graphics programming in cIntroduction to graphics programming in c
Introduction to graphics programming in c
 
Programming with OpenGL
Programming with OpenGLProgramming with OpenGL
Programming with OpenGL
 
Bai 1
Bai 1Bai 1
Bai 1
 
2D Drawing
2D Drawing2D Drawing
2D Drawing
 
OpenGL
OpenGLOpenGL
OpenGL
 
Intro to OpenGL ES 2.0
Intro to OpenGL ES 2.0Intro to OpenGL ES 2.0
Intro to OpenGL ES 2.0
 
Drawing Figures
Drawing FiguresDrawing Figures
Drawing Figures
 
OpenGL Introduction
OpenGL IntroductionOpenGL Introduction
OpenGL Introduction
 
OpenGL 3D Drawing
OpenGL 3D DrawingOpenGL 3D Drawing
OpenGL 3D Drawing
 
CGLabLec6.pptx
CGLabLec6.pptxCGLabLec6.pptx
CGLabLec6.pptx
 
Programa de objetos 3 d wire
Programa de objetos 3 d wirePrograma de objetos 3 d wire
Programa de objetos 3 d wire
 
openGL basics for sample program (1).ppt
openGL basics for sample program (1).pptopenGL basics for sample program (1).ppt
openGL basics for sample program (1).ppt
 
openGL basics for sample program.ppt
openGL basics for sample program.pptopenGL basics for sample program.ppt
openGL basics for sample program.ppt
 
05-Debug.pdf
05-Debug.pdf05-Debug.pdf
05-Debug.pdf
 
Draw Star in Visual Studio
Draw Star in Visual StudioDraw Star in Visual Studio
Draw Star in Visual Studio
 
Komputer Grafik
Komputer GrafikKomputer Grafik
Komputer Grafik
 
Computer graphics practical(jainam)
Computer graphics practical(jainam)Computer graphics practical(jainam)
Computer graphics practical(jainam)
 
Tutorial Open GL (Listing Code)
Tutorial Open GL (Listing Code)Tutorial Open GL (Listing Code)
Tutorial Open GL (Listing Code)
 

More from SH Rajøn

CD/DVD Drive Error Cause Detection and Solution
CD/DVD Drive Error Cause Detection and SolutionCD/DVD Drive Error Cause Detection and Solution
CD/DVD Drive Error Cause Detection and SolutionSH Rajøn
 
Movie Rating Site [for presentation]
Movie Rating Site [for presentation]Movie Rating Site [for presentation]
Movie Rating Site [for presentation]SH Rajøn
 
Random Access Memory [for presentation]
Random Access Memory [for presentation]Random Access Memory [for presentation]
Random Access Memory [for presentation]SH Rajøn
 
Airline Management System [for presentation]
Airline Management System [for presentation]Airline Management System [for presentation]
Airline Management System [for presentation]SH Rajøn
 
Airline management system
Airline management systemAirline management system
Airline management systemSH Rajøn
 
Airline ticket reservation system
Airline ticket reservation systemAirline ticket reservation system
Airline ticket reservation systemSH Rajøn
 
Random Access Memory ( RAM)
Random Access Memory ( RAM)Random Access Memory ( RAM)
Random Access Memory ( RAM)SH Rajøn
 

More from SH Rajøn (7)

CD/DVD Drive Error Cause Detection and Solution
CD/DVD Drive Error Cause Detection and SolutionCD/DVD Drive Error Cause Detection and Solution
CD/DVD Drive Error Cause Detection and Solution
 
Movie Rating Site [for presentation]
Movie Rating Site [for presentation]Movie Rating Site [for presentation]
Movie Rating Site [for presentation]
 
Random Access Memory [for presentation]
Random Access Memory [for presentation]Random Access Memory [for presentation]
Random Access Memory [for presentation]
 
Airline Management System [for presentation]
Airline Management System [for presentation]Airline Management System [for presentation]
Airline Management System [for presentation]
 
Airline management system
Airline management systemAirline management system
Airline management system
 
Airline ticket reservation system
Airline ticket reservation systemAirline ticket reservation system
Airline ticket reservation system
 
Random Access Memory ( RAM)
Random Access Memory ( RAM)Random Access Memory ( RAM)
Random Access Memory ( RAM)
 

Recently uploaded

Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 

Recently uploaded (20)

Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 

Togo National Flag

  • 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
  • 11. Codefor this primitive: glColor3f(1,1,1); // Draw a triangle: glBegin(GL_TRIANGLES); // Lower left vertex glVertex2f(-10.0f, 10.5f); // Lower right vertex glVertex2f( -25.0f, 10.5f); // Upper vertex glVertex2f(- 18.0f, 7.0f); glEnd(); glBegin(GL_TRIANGLES); // Lower left vertex glVertex2f(-18.0f, 15.0f); // Lower right vertex glVertex2f( -13.0f, 3.0f);
  • 12. // Upper vertex glVertex2f(- 19.0f, 8.0f); glEnd(); glBegin(GL_TRIANGLES); // Lower left vertex glVertex2f(-18.0f, 15.0f); // Lower right vertex glVertex2f( -17.0f, 8.0f); // Upper vertex glVertex2f(- 22.5f, 3.0f); glEnd(); glFlush();
  • 13. Code: //Name : SH Rajøn //ID : 1410 //Assignment Name : Flag of Togo #include<windows.h> #include<GL/glut.h> void flag() { 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(); glColor3f(1.000, 0.843, 0.000); glBegin(GL_QUADS); glVertex2d(30.0,11.0);
  • 15. 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(); glColor3f(1,1,1); // Draw a triangle: glBegin(GL_TRIANGLES); // Lower left vertex glVertex2f(-10.0f, 10.5f); // Lower right vertex glVertex2f( -25.0f, 10.5f); // Upper vertex glVertex2f(- 18.0f, 7.0f); glEnd(); glBegin(GL_TRIANGLES); // Lower left vertex glVertex2f(-18.0f, 15.0f);
  • 16. // Lower right vertex glVertex2f( -13.0f, 3.0f); // Upper vertex glVertex2f(- 19.0f, 8.0f); glEnd(); glBegin(GL_TRIANGLES); // Lower left vertex glVertex2f(-18.0f, 15.0f); // Lower right vertex glVertex2f( -17.0f, 8.0f); // Upper vertex glVertex2f(- 22.5f, 3.0f); glEnd(); glFlush(); } void Initialize() { glMatrixMode(GL_PROJECTION); glLoadIdentity();
  • 17. glClearColor(.96,0.87,0.70,0.0); glOrtho(-40, 40, -20, 20, -20, 20); } int main(int Argc, char** Argv) { glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(1170,620); glutInitWindowPosition(50,50); glutCreateWindow("Flag of Togo"); Initialize(); glutDisplayFunc(flag); glutMainLoop(); return 0; }