SlideShare a Scribd company logo
1 of 2
#include <gl//glut.h>
//#include<math.h>
void init ()
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glPointSize(5.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//setting the resolution for the 2D object
gluOrtho2D(0.0,300.0, 0.0, 300.0); //void gluOrtho2D(left,r,bot,top);
//gluOrtho2D sets up a two-dimensional orthographic viewing region.
//equivalent to calling glOrtho with near = -1 and far = 1 .
//void glOrtho(left,right,bottom,top,nearVal,farVal);
}
void CheckerBoard()
{
glPointSize(5.0);
//
int x1,y1;
x1=0;
y1=500;
for(int i=1;i<=8;i++)
{
x1=x1+50;
y1=500;
for(int j=1;j<=8;j++)
{
y1=y1-50;
glBegin(GL_QUADS);
if(i%2 != 0 )
{
if( j%2 != 0 )
{
//glColor3f(1.0,1.0,1.0); //white
glColor3f(202.0/255.00, 169.0/255.0,
106.0/255.0);//orange
glVertex3f(x1,y1,0);
glVertex3f(x1+50,y1,0);
glVertex3f(x1+50,y1-50,0);
glVertex3f(x1,y1-50,0);
}
else
{
glColor3f(146.0/255.0, 140.0/255.0,
168.0/255.0);//brown
//glColor3f(0.0,0.0,0.0); //black
glVertex3f(x1,y1,0);
glVertex3f(x1+50,y1,0);
glVertex3f(x1+50,y1-50,0);
glVertex3f(x1,y1-50,0);
}
}
else{
if(j%2 != 0)
{
glColor3f(146.0/255.0, 140.0/255.0,
168.0/255.0);
//glColor3f(0.0,0.0,0.0);
glVertex3f(x1,y1,0);
glVertex3f(x1+50,y1,0);
glVertex3f(x1+50,y1-50,0);
glVertex3f(x1,y1-50,0);
}
else{
glColor3f(202.0/255.00, 169.0/255.0,
106.0/255.0);
// glColor3f(1.0,1.0,1.0);
glVertex3f(x1,y1,0);
glVertex3f(x1+50,y1,0);
glVertex3f(x1+50,y1-50,0);
glVertex3f(x1,y1-50,0);
}
}
glEnd();
}
}
}
void Display()
{
glClear(GL_COLOR_BUFFER_BIT);
//calling
CheckerBoard();
glFlush ();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (900, 450);
glutInitWindowPosition (100, 100);
glutCreateWindow ("Assignment: Lab 2");
init ();
glutDisplayFunc(Display);
glutMainLoop();
}

More Related Content

What's hot

computer graphics at openGL (2)
computer graphics at openGL (2)computer graphics at openGL (2)
computer graphics at openGL (2)Yasir Khan
 
HelsinkiOS Jan 2015: Useful iOS Code Snippets
HelsinkiOS Jan 2015: Useful iOS Code SnippetsHelsinkiOS Jan 2015: Useful iOS Code Snippets
HelsinkiOS Jan 2015: Useful iOS Code SnippetsJouni Miettunen
 
Barcamp GoogleMaps - praktické ukázky kódu
Barcamp GoogleMaps - praktické ukázky kóduBarcamp GoogleMaps - praktické ukázky kódu
Barcamp GoogleMaps - praktické ukázky kóduMilos Lenoch
 
Recoil at Codete Webinars #3
Recoil at Codete Webinars #3Recoil at Codete Webinars #3
Recoil at Codete Webinars #3Mateusz Bryła
 
Having fun with graphs, a short introduction to D3.js
Having fun with graphs, a short introduction to D3.jsHaving fun with graphs, a short introduction to D3.js
Having fun with graphs, a short introduction to D3.jsMichael Hackstein
 
Ios13 bluetooth-dualshock4
Ios13 bluetooth-dualshock4Ios13 bluetooth-dualshock4
Ios13 bluetooth-dualshock4harumidiv
 
Computer lab (programs)
Computer lab (programs)Computer lab (programs)
Computer lab (programs)mshoaib15
 
Seeking the truth from mobile analytics
Seeking the truth from mobile analyticsSeeking the truth from mobile analytics
Seeking the truth from mobile analyticsMouhcine El Amine
 
Paperjs presentation
Paperjs presentationPaperjs presentation
Paperjs presentationsharp-blade
 
ORM is an Offensive Anti-Pattern
ORM is an Offensive Anti-PatternORM is an Offensive Anti-Pattern
ORM is an Offensive Anti-PatternYegor Bugayenko
 
Human-powered Javascript Compression for Fun and Gummy Bears
Human-powered Javascript Compression for Fun and Gummy BearsHuman-powered Javascript Compression for Fun and Gummy Bears
Human-powered Javascript Compression for Fun and Gummy BearsRui Lopes
 
C언어 스터디 강의자료 - 1차시
C언어 스터디 강의자료 - 1차시C언어 스터디 강의자료 - 1차시
C언어 스터디 강의자료 - 1차시Junha Jang
 

What's hot (18)

computer graphics at openGL (2)
computer graphics at openGL (2)computer graphics at openGL (2)
computer graphics at openGL (2)
 
135
135135
135
 
HelsinkiOS Jan 2015: Useful iOS Code Snippets
HelsinkiOS Jan 2015: Useful iOS Code SnippetsHelsinkiOS Jan 2015: Useful iOS Code Snippets
HelsinkiOS Jan 2015: Useful iOS Code Snippets
 
Barcamp GoogleMaps - praktické ukázky kódu
Barcamp GoogleMaps - praktické ukázky kóduBarcamp GoogleMaps - praktické ukázky kódu
Barcamp GoogleMaps - praktické ukázky kódu
 
cosc 281 hw2
cosc 281 hw2cosc 281 hw2
cosc 281 hw2
 
Recoil at Codete Webinars #3
Recoil at Codete Webinars #3Recoil at Codete Webinars #3
Recoil at Codete Webinars #3
 
Having fun with graphs, a short introduction to D3.js
Having fun with graphs, a short introduction to D3.jsHaving fun with graphs, a short introduction to D3.js
Having fun with graphs, a short introduction to D3.js
 
Ios13 bluetooth-dualshock4
Ios13 bluetooth-dualshock4Ios13 bluetooth-dualshock4
Ios13 bluetooth-dualshock4
 
Computer lab (programs)
Computer lab (programs)Computer lab (programs)
Computer lab (programs)
 
Seeking the truth from mobile analytics
Seeking the truth from mobile analyticsSeeking the truth from mobile analytics
Seeking the truth from mobile analytics
 
Paperjs presentation
Paperjs presentationPaperjs presentation
Paperjs presentation
 
ORM is an Offensive Anti-Pattern
ORM is an Offensive Anti-PatternORM is an Offensive Anti-Pattern
ORM is an Offensive Anti-Pattern
 
Human-powered Javascript Compression for Fun and Gummy Bears
Human-powered Javascript Compression for Fun and Gummy BearsHuman-powered Javascript Compression for Fun and Gummy Bears
Human-powered Javascript Compression for Fun and Gummy Bears
 
C언어 스터디 강의자료 - 1차시
C언어 스터디 강의자료 - 1차시C언어 스터디 강의자료 - 1차시
C언어 스터디 강의자료 - 1차시
 
Drawing Figures
Drawing FiguresDrawing Figures
Drawing Figures
 
Ruby haskell extension
Ruby haskell extensionRuby haskell extension
Ruby haskell extension
 
Structure
StructureStructure
Structure
 
7. chapter vi
7. chapter vi7. chapter vi
7. chapter vi
 

Viewers also liked (18)

An inquiry based project for stem
An inquiry based project for stemAn inquiry based project for stem
An inquiry based project for stem
 
Una giornata a pentedattilo
Una giornata a pentedattiloUna giornata a pentedattilo
Una giornata a pentedattilo
 
Fracturas tipos
Fracturas tiposFracturas tipos
Fracturas tipos
 
ร้องกวาง
ร้องกวางร้องกวาง
ร้องกวาง
 
ลอง
ลองลอง
ลอง
 
Gif and images
Gif and imagesGif and images
Gif and images
 
Proyecto de las tic
Proyecto de las ticProyecto de las tic
Proyecto de las tic
 
เมืองแพร่
เมืองแพร่เมืองแพร่
เมืองแพร่
 
Turner Resume
Turner ResumeTurner Resume
Turner Resume
 
fgcu_fpra_internship_fair_2014_division_d_category_5_entry
fgcu_fpra_internship_fair_2014_division_d_category_5_entryfgcu_fpra_internship_fair_2014_division_d_category_5_entry
fgcu_fpra_internship_fair_2014_division_d_category_5_entry
 
Tecnotaaller
TecnotaallerTecnotaaller
Tecnotaaller
 
Redes de área local
Redes de área localRedes de área local
Redes de área local
 
Ultimo formato magola
Ultimo formato magolaUltimo formato magola
Ultimo formato magola
 
highly effective teens
highly effective teenshighly effective teens
highly effective teens
 
Departamentos de córdoba tobias
Departamentos de córdoba tobiasDepartamentos de córdoba tobias
Departamentos de córdoba tobias
 
Konsep tata ruang benua maritim
Konsep tata ruang benua maritimKonsep tata ruang benua maritim
Konsep tata ruang benua maritim
 
เด่นชัย
เด่นชัยเด่นชัย
เด่นชัย
 
EMI Style Usage Troubleshooting Guide
EMI Style Usage Troubleshooting GuideEMI Style Usage Troubleshooting Guide
EMI Style Usage Troubleshooting Guide
 

Similar to Ass day2 1_checkerboard...copy in cpp

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 and Multimedia lab report
Computer Graphics and Multimedia lab reportComputer Graphics and Multimedia lab report
Computer Graphics and Multimedia lab reportBijoy679
 
animation.#include windows.h#include GLglut.h#inclu.pdf
animation.#include windows.h#include GLglut.h#inclu.pdfanimation.#include windows.h#include GLglut.h#inclu.pdf
animation.#include windows.h#include GLglut.h#inclu.pdfambritgames
 
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
 
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
 
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
 
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
 
computer graphics at openGL
computer graphics at openGLcomputer graphics at openGL
computer graphics at openGLYasir Khan
 
FLTK Summer Course - Part VIII - Eighth Impact - Exercises
FLTK Summer Course - Part VIII - Eighth Impact - ExercisesFLTK Summer Course - Part VIII - Eighth Impact - Exercises
FLTK Summer Course - Part VIII - Eighth Impact - ExercisesMichel Alves
 
The Ring programming language version 1.5.2 book - Part 54 of 181
The Ring programming language version 1.5.2 book - Part 54 of 181The Ring programming language version 1.5.2 book - Part 54 of 181
The Ring programming language version 1.5.2 book - Part 54 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 57 of 189
The Ring programming language version 1.6 book - Part 57 of 189The Ring programming language version 1.6 book - Part 57 of 189
The Ring programming language version 1.6 book - Part 57 of 189Mahmoud Samir Fayed
 
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
 
Ass day3 1_bd flag
Ass day3 1_bd flagAss day3 1_bd flag
Ass day3 1_bd flagRobi Parvez
 
01.Opengl_intro-2.ppt
01.Opengl_intro-2.ppt01.Opengl_intro-2.ppt
01.Opengl_intro-2.pptEngrZamaan
 

Similar to Ass day2 1_checkerboard...copy in cpp (20)

Tutorial Open GL (Listing Code)
Tutorial Open GL (Listing Code)Tutorial Open GL (Listing Code)
Tutorial Open GL (Listing Code)
 
Computer Graphics and Multimedia lab report
Computer Graphics and Multimedia lab reportComputer Graphics and Multimedia lab report
Computer Graphics and Multimedia lab report
 
animation.#include windows.h#include GLglut.h#inclu.pdf
animation.#include windows.h#include GLglut.h#inclu.pdfanimation.#include windows.h#include GLglut.h#inclu.pdf
animation.#include windows.h#include GLglut.h#inclu.pdf
 
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)
 
Programa de objetos 3 d wire
Programa de objetos 3 d wirePrograma de objetos 3 d wire
Programa de objetos 3 d wire
 
Robot by gulnaz
Robot by gulnazRobot by gulnaz
Robot by gulnaz
 
Robot by gulnaz
Robot by gulnazRobot by gulnaz
Robot by gulnaz
 
#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
 
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 In OpenGL Using Line Function
Robot In OpenGL Using Line Function Robot In OpenGL Using Line Function
Robot In OpenGL Using Line Function
 
Practica
PracticaPractica
Practica
 
computer graphics at openGL
computer graphics at openGLcomputer graphics at openGL
computer graphics at openGL
 
FLTK Summer Course - Part VIII - Eighth Impact - Exercises
FLTK Summer Course - Part VIII - Eighth Impact - ExercisesFLTK Summer Course - Part VIII - Eighth Impact - Exercises
FLTK Summer Course - Part VIII - Eighth Impact - Exercises
 
The Ring programming language version 1.5.2 book - Part 54 of 181
The Ring programming language version 1.5.2 book - Part 54 of 181The Ring programming language version 1.5.2 book - Part 54 of 181
The Ring programming language version 1.5.2 book - Part 54 of 181
 
Robot by gulnaz
Robot by gulnazRobot by gulnaz
Robot by gulnaz
 
Robot by gulnaz
Robot by gulnazRobot by gulnaz
Robot by gulnaz
 
The Ring programming language version 1.6 book - Part 57 of 189
The Ring programming language version 1.6 book - Part 57 of 189The Ring programming language version 1.6 book - Part 57 of 189
The Ring programming language version 1.6 book - Part 57 of 189
 
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
 
Ass day3 1_bd flag
Ass day3 1_bd flagAss day3 1_bd flag
Ass day3 1_bd flag
 
01.Opengl_intro-2.ppt
01.Opengl_intro-2.ppt01.Opengl_intro-2.ppt
01.Opengl_intro-2.ppt
 

Recently uploaded

DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
“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
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
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
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
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
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 

Recently uploaded (20)

DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
“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...
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
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
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
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
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 

Ass day2 1_checkerboard...copy in cpp

  • 1. #include <gl//glut.h> //#include<math.h> void init () { glClearColor(0.0, 0.0, 0.0, 0.0); glPointSize(5.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); //setting the resolution for the 2D object gluOrtho2D(0.0,300.0, 0.0, 300.0); //void gluOrtho2D(left,r,bot,top); //gluOrtho2D sets up a two-dimensional orthographic viewing region. //equivalent to calling glOrtho with near = -1 and far = 1 . //void glOrtho(left,right,bottom,top,nearVal,farVal); } void CheckerBoard() { glPointSize(5.0); // int x1,y1; x1=0; y1=500; for(int i=1;i<=8;i++) { x1=x1+50; y1=500; for(int j=1;j<=8;j++) { y1=y1-50; glBegin(GL_QUADS); if(i%2 != 0 ) { if( j%2 != 0 ) { //glColor3f(1.0,1.0,1.0); //white glColor3f(202.0/255.00, 169.0/255.0, 106.0/255.0);//orange glVertex3f(x1,y1,0); glVertex3f(x1+50,y1,0); glVertex3f(x1+50,y1-50,0); glVertex3f(x1,y1-50,0); } else { glColor3f(146.0/255.0, 140.0/255.0, 168.0/255.0);//brown //glColor3f(0.0,0.0,0.0); //black glVertex3f(x1,y1,0); glVertex3f(x1+50,y1,0); glVertex3f(x1+50,y1-50,0); glVertex3f(x1,y1-50,0); } }
  • 2. else{ if(j%2 != 0) { glColor3f(146.0/255.0, 140.0/255.0, 168.0/255.0); //glColor3f(0.0,0.0,0.0); glVertex3f(x1,y1,0); glVertex3f(x1+50,y1,0); glVertex3f(x1+50,y1-50,0); glVertex3f(x1,y1-50,0); } else{ glColor3f(202.0/255.00, 169.0/255.0, 106.0/255.0); // glColor3f(1.0,1.0,1.0); glVertex3f(x1,y1,0); glVertex3f(x1+50,y1,0); glVertex3f(x1+50,y1-50,0); glVertex3f(x1,y1-50,0); } } glEnd(); } } } void Display() { glClear(GL_COLOR_BUFFER_BIT); //calling CheckerBoard(); glFlush (); } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); glutInitWindowSize (900, 450); glutInitWindowPosition (100, 100); glutCreateWindow ("Assignment: Lab 2"); init (); glutDisplayFunc(Display); glutMainLoop(); }