SlideShare a Scribd company logo
1 of 9
Robot by
Gulnaz
 // CGassignment2.cpp : Making a simple Robot;
 //Gulnaz Akhter;
 #include "stdafx.h"
 // Run by Visual C++ 6 with OpenGL
 #include <math.h>
 #include <glut.h>
 void init (void)
 {
 /* select clearing (background) color */
 glClearColor (0.0, 0.0, 0.0, 1.0);
 // (red, green, blue, alpha), used by glClear
 /* initialize viewing values */
 glMatrixMode(GL_PROJECTION);
 glLoadIdentity();
 glOrtho(1.0, -1.0, -1.0, 1.0, -1.0, -1.0);
 // (left, right, bottom, top, near, far)
 }
 void display(void)
 {


 glColor3f (1.0, 0.0, 0.0);
 glBegin(GL_POLYGON);
 //Head;
 glVertex2f (0.08, 0.11);
 glVertex2f (0.01, 0.11);
 glVertex2f (0.01, 0.20);
 glVertex2f (0.08, 0.20);
 glEnd();
 glTranslatef(-0.01,0.07,0.00);
 glTranslatef(0.07,-0.20,0.00);
 glColor3f (1.0, 0.0, 0.0);
 glBegin(GL_POLYGON);
 //Body;
 glVertex2f (-0.05, -0.05);
 glVertex2f (0.02, -0.05);
 glVertex2f (0.02, 0.18);
 glVertex2f (-0.05, 0.18);
 glEnd();
 glTranslatef(-0.04,0.2,0.00);
 glColor3f (1.0, 0.0, 0.0);
 glBegin(GL_POLYGON);
 //Neck;
 glVertex2f (0.03, 0.06);
 glVertex2f (0.02, 0.06);
 glVertex2f (0.02, -0.02);
 glVertex2f (0.03, -0.02);
 glEnd();
 glTranslatef(0.02,-0.56,0.00);
 glColor3f (1.0, 0.0, 0.0);
 glBegin(GL_POLYGON);
 //Right Leg;
 glVertex2f (0.04, 0.10);
 glVertex2f (0.02, 0.10);
 glVertex2f (0.02, 0.30);
 glVertex2f (0.04, 0.30);
 glEnd();
 glTranslatef(-0.06,-0.01,0.00);
 glColor3f (1.0, 0.0, 0.0);
 glBegin(GL_POLYGON);
 //Left Leg;
 glVertex2f (0.05, 0.11);
 glVertex2f (0.03, 0.11);
 glVertex2f (0.03, 0.31);
 glVertex2f (0.05, 0.31);
 glEnd();
 //Mouth
 glTranslatef(0.05,0.63,0.00);
 glColor3f (0.0, 1.0, 0.0);
 glBegin(GL_LINES);
 glVertex2f(.03,0.00);
 glVertex2f(.00,.00);

 glEnd();


 // (red, green, blue)
 glTranslatef(0.00,-0.03,0.00);
 //glColor3f (0.0, 0.0, 1.0);
 glPointSize(4);
 glBegin(GL_POINTS);
 glVertex3f (0.00, 0.08, 0.0);
 glEnd();
 glTranslatef(-0.02,0.00,0.00);
 //glColor3f (0.0, 0.0, 1.0);
 glPointSize(4);
 glBegin(GL_POINTS);
 glVertex3f (0.05, 0.08, 0.0);

 glEnd();
 glTranslatef(-0.05,-0.15,0.00);
 glColor3f (1.0, 0.0, 0.0);
 glBegin(GL_POLYGON);
 //Right hand;
 glVertex2f (0.04, 0.10);
 glVertex2f (0.02, 0.10);
 glVertex2f (0.02, 0.30);
 glVertex2f (0.04, 0.30);
 glEnd();
 glTranslatef(0.10,-0.21,0.00);
 glColor3f (1.0, 0.0, 0.0);
 glBegin(GL_POLYGON);
 //Left hand;
 glVertex2f (0.05, 0.11);
 glVertex2f (0.03, 0.11);
 glVertex2f (0.03, 0.31);
 glVertex2f (0.05, 0.31);
 glEnd();
 glFlush ();
 }
 int main(int argc, char** argv)
 {
 glutInit(&argc, argv);
 glutInitWindowSize (600, 500);
 glutInitWindowPosition (200, 100);
 // Screen origin (0,0) is at Top Left
 glutCreateWindow ("Hello Computer Graphics Students");
 init(); // calling init()
 glutDisplayFunc(display); // glut call back function,
calling display()
 glutMainLoop();
 return 0; // ANSI C requires main to return int.
 }

More Related Content

Similar to Robot by gulnaz

Robot In OpenGL Using Line Function
Robot In OpenGL Using Line Function Robot In OpenGL Using Line Function
Robot In OpenGL Using Line Function Jannat Jamshed
 
Ass day2 2_rotating my name (robi)
Ass day2 2_rotating my name (robi)Ass day2 2_rotating my name (robi)
Ass day2 2_rotating my name (robi)Robi Parvez
 
Tutorial Open GL (Listing Code)
Tutorial Open GL (Listing Code)Tutorial Open GL (Listing Code)
Tutorial Open GL (Listing Code)Aila Gema Safitri
 
computer graphics at openGL
computer graphics at openGLcomputer graphics at openGL
computer graphics at openGLYasir Khan
 
Ass day3 2_olympic logos
Ass day3 2_olympic logosAss day3 2_olympic logos
Ass day3 2_olympic logosRobi Parvez
 
Programa de objetos 3 d wire
Programa de objetos 3 d wirePrograma de objetos 3 d wire
Programa de objetos 3 d wireRené Domínguez
 
#includefloat angle, move, scene, roadmove,turn, on=1; int i, st.docx
#includefloat angle, move, scene, roadmove,turn, on=1; int i, st.docx#includefloat angle, move, scene, roadmove,turn, on=1; int i, st.docx
#includefloat angle, move, scene, roadmove,turn, on=1; int i, st.docxajoy21
 
Computer Graphics and Multimedia lab report
Computer Graphics and Multimedia lab reportComputer Graphics and Multimedia lab report
Computer Graphics and Multimedia lab reportBijoy679
 
square.cpp Open
 square.cpp Open square.cpp Open
square.cpp OpenMikeEly930
 
The Ring programming language version 1.7 book - Part 60 of 196
The Ring programming language version 1.7 book - Part 60 of 196The Ring programming language version 1.7 book - Part 60 of 196
The Ring programming language version 1.7 book - Part 60 of 196Mahmoud Samir Fayed
 
computer graphics at openGL (2)
computer graphics at openGL (2)computer graphics at openGL (2)
computer graphics at openGL (2)Yasir Khan
 
The Ring programming language version 1.5.3 book - Part 65 of 184
The Ring programming language version 1.5.3 book - Part 65 of 184The Ring programming language version 1.5.3 book - Part 65 of 184
The Ring programming language version 1.5.3 book - Part 65 of 184Mahmoud Samir Fayed
 
Robot Motion Source code
Robot Motion Source codeRobot Motion Source code
Robot Motion Source codeBrian Goggins
 
The Ring programming language version 1.9 book - Part 65 of 210
The Ring programming language version 1.9 book - Part 65 of 210The Ring programming language version 1.9 book - Part 65 of 210
The Ring programming language version 1.9 book - Part 65 of 210Mahmoud Samir Fayed
 

Similar to Robot by gulnaz (20)

Robot In OpenGL Using Line Function
Robot In OpenGL Using Line Function Robot In OpenGL Using Line Function
Robot In OpenGL Using Line Function
 
Robot by gulnaz
Robot by gulnazRobot by gulnaz
Robot by gulnaz
 
Ass day2 2_rotating my name (robi)
Ass day2 2_rotating my name (robi)Ass day2 2_rotating my name (robi)
Ass day2 2_rotating my name (robi)
 
Tutorial Open GL (Listing Code)
Tutorial Open GL (Listing Code)Tutorial Open GL (Listing Code)
Tutorial Open GL (Listing Code)
 
computer graphics at openGL
computer graphics at openGLcomputer graphics at openGL
computer graphics at openGL
 
Ass day3 2_olympic logos
Ass day3 2_olympic logosAss day3 2_olympic logos
Ass day3 2_olympic logos
 
Programa de objetos 3 d wire
Programa de objetos 3 d wirePrograma de objetos 3 d wire
Programa de objetos 3 d wire
 
#includefloat angle, move, scene, roadmove,turn, on=1; int i, st.docx
#includefloat angle, move, scene, roadmove,turn, on=1; int i, st.docx#includefloat angle, move, scene, roadmove,turn, on=1; int i, st.docx
#includefloat angle, move, scene, roadmove,turn, on=1; int i, st.docx
 
Development with OpenGL and Qt
Development with OpenGL and QtDevelopment with OpenGL and Qt
Development with OpenGL and Qt
 
Computer Graphics and Multimedia lab report
Computer Graphics and Multimedia lab reportComputer Graphics and Multimedia lab report
Computer Graphics and Multimedia lab report
 
Grafika komputer 2
Grafika komputer 2Grafika komputer 2
Grafika komputer 2
 
Komputer Grafik
Komputer GrafikKomputer Grafik
Komputer Grafik
 
square.cpp Open
 square.cpp Open square.cpp Open
square.cpp Open
 
The Ring programming language version 1.7 book - Part 60 of 196
The Ring programming language version 1.7 book - Part 60 of 196The Ring programming language version 1.7 book - Part 60 of 196
The Ring programming language version 1.7 book - Part 60 of 196
 
Practicing 2d drawing primitives
Practicing 2d drawing primitivesPracticing 2d drawing primitives
Practicing 2d drawing primitives
 
Practica
PracticaPractica
Practica
 
computer graphics at openGL (2)
computer graphics at openGL (2)computer graphics at openGL (2)
computer graphics at openGL (2)
 
The Ring programming language version 1.5.3 book - Part 65 of 184
The Ring programming language version 1.5.3 book - Part 65 of 184The Ring programming language version 1.5.3 book - Part 65 of 184
The Ring programming language version 1.5.3 book - Part 65 of 184
 
Robot Motion Source code
Robot Motion Source codeRobot Motion Source code
Robot Motion Source code
 
The Ring programming language version 1.9 book - Part 65 of 210
The Ring programming language version 1.9 book - Part 65 of 210The Ring programming language version 1.9 book - Part 65 of 210
The Ring programming language version 1.9 book - Part 65 of 210
 

Recently uploaded

Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 

Recently uploaded (20)

Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 

Robot by gulnaz

  • 2.  // CGassignment2.cpp : Making a simple Robot;  //Gulnaz Akhter;  #include "stdafx.h"  // Run by Visual C++ 6 with OpenGL  #include <math.h>  #include <glut.h>  void init (void)  {  /* select clearing (background) color */  glClearColor (0.0, 0.0, 0.0, 1.0);  // (red, green, blue, alpha), used by glClear  /* initialize viewing values */  glMatrixMode(GL_PROJECTION);  glLoadIdentity();  glOrtho(1.0, -1.0, -1.0, 1.0, -1.0, -1.0);  // (left, right, bottom, top, near, far)  }
  • 3.  void display(void)  {    glColor3f (1.0, 0.0, 0.0);  glBegin(GL_POLYGON);  //Head;  glVertex2f (0.08, 0.11);  glVertex2f (0.01, 0.11);  glVertex2f (0.01, 0.20);  glVertex2f (0.08, 0.20);  glEnd();  glTranslatef(-0.01,0.07,0.00);  glTranslatef(0.07,-0.20,0.00);  glColor3f (1.0, 0.0, 0.0);  glBegin(GL_POLYGON);
  • 4.  //Body;  glVertex2f (-0.05, -0.05);  glVertex2f (0.02, -0.05);  glVertex2f (0.02, 0.18);  glVertex2f (-0.05, 0.18);  glEnd();  glTranslatef(-0.04,0.2,0.00);  glColor3f (1.0, 0.0, 0.0);  glBegin(GL_POLYGON);  //Neck;  glVertex2f (0.03, 0.06);  glVertex2f (0.02, 0.06);  glVertex2f (0.02, -0.02);  glVertex2f (0.03, -0.02);  glEnd();
  • 5.  glTranslatef(0.02,-0.56,0.00);  glColor3f (1.0, 0.0, 0.0);  glBegin(GL_POLYGON);  //Right Leg;  glVertex2f (0.04, 0.10);  glVertex2f (0.02, 0.10);  glVertex2f (0.02, 0.30);  glVertex2f (0.04, 0.30);  glEnd();  glTranslatef(-0.06,-0.01,0.00);  glColor3f (1.0, 0.0, 0.0);  glBegin(GL_POLYGON);
  • 6.  //Left Leg;  glVertex2f (0.05, 0.11);  glVertex2f (0.03, 0.11);  glVertex2f (0.03, 0.31);  glVertex2f (0.05, 0.31);  glEnd();  //Mouth  glTranslatef(0.05,0.63,0.00);  glColor3f (0.0, 1.0, 0.0);  glBegin(GL_LINES);  glVertex2f(.03,0.00);  glVertex2f(.00,.00);   glEnd();
  • 7.    // (red, green, blue)  glTranslatef(0.00,-0.03,0.00);  //glColor3f (0.0, 0.0, 1.0);  glPointSize(4);  glBegin(GL_POINTS);  glVertex3f (0.00, 0.08, 0.0);  glEnd();  glTranslatef(-0.02,0.00,0.00);  //glColor3f (0.0, 0.0, 1.0);  glPointSize(4);  glBegin(GL_POINTS);  glVertex3f (0.05, 0.08, 0.0);   glEnd();
  • 8.  glTranslatef(-0.05,-0.15,0.00);  glColor3f (1.0, 0.0, 0.0);  glBegin(GL_POLYGON);  //Right hand;  glVertex2f (0.04, 0.10);  glVertex2f (0.02, 0.10);  glVertex2f (0.02, 0.30);  glVertex2f (0.04, 0.30);  glEnd();  glTranslatef(0.10,-0.21,0.00);  glColor3f (1.0, 0.0, 0.0);  glBegin(GL_POLYGON);  //Left hand;
  • 9.  glVertex2f (0.05, 0.11);  glVertex2f (0.03, 0.11);  glVertex2f (0.03, 0.31);  glVertex2f (0.05, 0.31);  glEnd();  glFlush ();  }  int main(int argc, char** argv)  {  glutInit(&argc, argv);  glutInitWindowSize (600, 500);  glutInitWindowPosition (200, 100);  // Screen origin (0,0) is at Top Left  glutCreateWindow ("Hello Computer Graphics Students");  init(); // calling init()  glutDisplayFunc(display); // glut call back function, calling display()  glutMainLoop();  return 0; // ANSI C requires main to return int.  }