Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GL/gl.h>
- #include <GL/glut.h>
- int x = 0, y = 0;
- void yellowbox(int x,int y,int w,int h)
- {
- glColor3f(255,255,0);
- glBegin(GL_POLYGON);
- glVertex2i(x,y);
- glVertex2i(x+w,y);
- glVertex2i(x+w,y+h);
- glVertex2i(x,y+h);
- glEnd();
- }
- void blackbox(int x,int y,int w,int h)
- {
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(x,y);
- glVertex2i(x+w,y);
- glVertex2i(x+w,y+h);
- glVertex2i(x,y+h);
- glEnd();
- }
- void display(void)
- {
- int w = 20, h = 20;
- glClear(GL_COLOR_BUFFER_BIT);
- for(;x<=690;x+=21){
- for(y=0;y<=500;y+=21){
- glColor3f(1,1,1);
- glBegin(GL_POLYGON);
- glVertex2i(x,y);
- glVertex2i(x+w,y);
- glVertex2i(x+w,y+h);
- glVertex2i(x,y+h);
- glEnd();
- }
- }
- /// 1St Line
- for(y=189;y<340;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(21,y);
- glVertex2i(21+w,y);
- glVertex2i(21+w,y+h);
- glVertex2i(21,y+h);
- glEnd();
- }
- ///2nd Line
- for(y=189;y<340;y+=21){
- glColor3f(255,255,0);
- glBegin(GL_POLYGON);
- glVertex2i(42,y);
- glVertex2i(42+w,y);
- glVertex2i(42+w,y+h);
- glVertex2i(42,y+h);
- glEnd();
- }
- blackbox(42,168,w,h);
- blackbox(42,357,w,h);
- /// 3rd Line
- for(y=210;y<320;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(63,y);
- glVertex2i(63+w,y);
- glVertex2i(63+w,y+h);
- glVertex2i(63,y+h);
- glEnd();
- }
- yellowbox(63,189,w,h);
- yellowbox(63,168,w,h);
- yellowbox(63,336,w,h);
- yellowbox(63,357,w,h);
- blackbox(63,378,w,h);
- blackbox(63,147,w,h);
- // 4th LINE
- for(y=189;y<340;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(84,y);
- glVertex2i(84+w,y);
- glVertex2i(84+w,y+h);
- glVertex2i(84,y+h);
- glEnd();
- }
- yellowbox(84,147,w,h);
- yellowbox(84,168,w,h);
- blackbox(84,126,w,h);
- yellowbox(84,357,w,h);
- yellowbox(84,378,w,h);
- blackbox(84,399,w,h);
- // 5th LINE************
- for(y=168;y<360;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(105,y);
- glVertex2i(105+w,y);
- glVertex2i(105+w,y+h);
- glVertex2i(105,y+h);
- glEnd();
- }
- yellowbox(105,126,w,h);
- yellowbox(105,147,w,h);
- blackbox(105,105,w,h);
- yellowbox(105,378,w,h);
- yellowbox(105,399,w,h);
- blackbox(105,420,w,h);
- //6th LINE
- for(y=147;y<380;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(126,y);
- glVertex2i(126+w,y);
- glVertex2i(126+w,y+h);
- glVertex2i(126,y+h);
- glEnd();
- }
- yellowbox(126,105,w,h);
- yellowbox(126,126,w,h);
- blackbox(126,84,w,h);
- yellowbox(126,399,w,h);
- yellowbox(126,420,w,h);
- blackbox(126,441,w,h);
- //7th Line
- for(y=126;y<400;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(147,y);
- glVertex2i(147+w,y);
- glVertex2i(147+w,y+h);
- glVertex2i(147,y+h);
- glEnd();
- }
- yellowbox(147,84,w,h);
- yellowbox(147,105,w,h);
- blackbox(147,63,w,h);
- yellowbox(147,420,w,h);
- yellowbox(147,441,w,h);
- blackbox(147,462,w,h);
- //8th Line
- for(y=105;y<440;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(168,y);
- glVertex2i(168+w,y);
- glVertex2i(168+w,y+h);
- glVertex2i(168,y+h);
- glEnd();
- }
- yellowbox(168,63,w,h);
- yellowbox(168,84,w,h);
- blackbox(168,42,w,h);
- yellowbox(168,441,w,h);
- yellowbox(168,462,w,h);
- blackbox(168,483,w,h);
- //9th LINE
- for(y=105;y<440;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(189,y);
- glVertex2i(189+w,y);
- glVertex2i(189+w,y+h);
- glVertex2i(189,y+h);
- glEnd();
- }
- yellowbox(189,63,w,h);
- yellowbox(189,84,w,h);
- blackbox(189,42,w,h);
- yellowbox(189,441,w,h);
- yellowbox(189,462,w,h);
- blackbox(189,483,w,h);
- // 10th Line
- for(y=84;y<340;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(210,y);
- glVertex2i(210+w,y);
- glVertex2i(210+w,y+h);
- glVertex2i(210,y+h);
- glEnd();
- }
- yellowbox(210,63,w,h);
- blackbox(210,42,w,h);
- yellowbox(210,357,w,h);
- yellowbox(210,378,w,h);
- yellowbox(210,399,w,h);
- blackbox(210,420,w,h);
- yellowbox(210,441,w,h);
- yellowbox(210,462,w,h);
- blackbox(210,483,w,h);
- //11th LINE
- for(y=126;y<320;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(231,y);
- glVertex2i(231+w,y);
- glVertex2i(231+w,y+h);
- glVertex2i(231,y+h);
- glEnd();
- }
- yellowbox(231,63,w,h);
- yellowbox(231,84,w,h);
- yellowbox(231,105,w,h);
- blackbox(231,42,w,h);
- blackbox(231,483,w,h);
- for(y=336;y<480;y+=21){
- glColor3f(255,255,0);
- glBegin(GL_POLYGON);
- glVertex2i(231,y);
- glVertex2i(231+w,y);
- glVertex2i(231+w,y+h);
- glVertex2i(231,y+h);
- glEnd();
- }
- //12th LINE ****
- for(y=147;y<300;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(252,y);
- glVertex2i(252+w,y);
- glVertex2i(252+w,y+h);
- glVertex2i(252,y+h);
- glEnd();
- }
- for(y=336;y<480;y+=21){
- glColor3f(255,255,0);
- glBegin(GL_POLYGON);
- glVertex2i(252,y);
- glVertex2i(252+w,y);
- glVertex2i(252+w,y+h);
- glVertex2i(252,y+h);
- glEnd();
- }
- blackbox(252,483,w,h);
- yellowbox(252,63,w,h);
- yellowbox(252,84,w,h);
- yellowbox(252,105,w,h);
- yellowbox(252,126,w,h);
- blackbox(252,42,w,h);
- blackbox(252,315,w,h);
- //13th Line
- for(y=357;y<480;y+=21){
- glColor3f(255,255,0);
- glBegin(GL_POLYGON);
- glVertex2i(273,y);
- glVertex2i(273+w,y);
- glVertex2i(273+w,y+h);
- glVertex2i(273,y+h);
- glEnd();
- }
- for(y=168;y<340;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(273,y);
- glVertex2i(273+w,y);
- glVertex2i(273+w,y+h);
- glVertex2i(273,y+h);
- glEnd();
- }
- for(y=63;y<160;y+=21){
- glColor3f(255,255,0);
- glBegin(GL_POLYGON);
- glVertex2i(273,y);
- glVertex2i(273+w,y);
- glVertex2i(273+w,y+h);
- glVertex2i(273,y+h);
- glEnd();
- }
- blackbox(273,42,w,h);
- blackbox(273,483,w,h);
- //14th Line
- for(y=147;y<460;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(294,y);
- glVertex2i(294+w,y);
- glVertex2i(294+w,y+h);
- glVertex2i(294,y+h);
- glEnd();
- }
- for(y=63;y<140;y+=21){
- glColor3f(255,255,0);
- glBegin(GL_POLYGON);
- glVertex2i(294,y);
- glVertex2i(294+w,y);
- glVertex2i(294+w,y+h);
- glVertex2i(294,y+h);
- glEnd();
- }
- blackbox(294,42,w,h);
- blackbox(294,483,w,h);
- yellowbox(294,462,w,h);
- //15th Line
- for(y=105;y<440;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(315,y);
- glVertex2i(315+w,y);
- glVertex2i(315+w,y+h);
- glVertex2i(315,y+h);
- glEnd();
- }
- blackbox(315,42,w,h);
- blackbox(315,483,w,h);
- yellowbox(315,63,w,h);
- yellowbox(315,84,w,h);
- yellowbox(315,462,w,h);
- yellowbox(315,441,w,h);
- //16th Line
- for(y=84;y<440;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(336,y);
- glVertex2i(336+w,y);
- glVertex2i(336+w,y+h);
- glVertex2i(336,y+h);
- glEnd();
- }
- blackbox(336,42,w,h);
- blackbox(336,483,w,h);
- yellowbox(336,63,w,h);
- yellowbox(336,462,w,h);
- yellowbox(336,441,w,h);
- //17th Line 15
- for(y=105;y<440;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(357,y);
- glVertex2i(357+w,y);
- glVertex2i(357+w,y+h);
- glVertex2i(357,y+h);
- glEnd();
- }
- blackbox(357,42,w,h);
- blackbox(357,483,w,h);
- yellowbox(357,63,w,h);
- yellowbox(357,84,w,h);
- yellowbox(357,462,w,h);
- yellowbox(357,441,w,h);
- //18th Line 14
- for(y=147;y<460;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(378,y);
- glVertex2i(378+w,y);
- glVertex2i(378+w,y+h);
- glVertex2i(378,y+h);
- glEnd();
- }
- for(y=63;y<140;y+=21){
- glColor3f(255,255,0);
- glBegin(GL_POLYGON);
- glVertex2i(378,y);
- glVertex2i(378+w,y);
- glVertex2i(378+w,y+h);
- glVertex2i(378,y+h);
- glEnd();
- }
- blackbox(378,42,w,h);
- blackbox(378,483,w,h);
- yellowbox(378,462,w,h);
- //19th Line 13
- for(y=357;y<480;y+=21){
- glColor3f(255,255,0);
- glBegin(GL_POLYGON);
- glVertex2i(399,y);
- glVertex2i(399+w,y);
- glVertex2i(399+w,y+h);
- glVertex2i(399,y+h);
- glEnd();
- }
- for(y=168;y<340;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(399,y);
- glVertex2i(399+w,y);
- glVertex2i(399+w,y+h);
- glVertex2i(399,y+h);
- glEnd();
- }
- for(y=63;y<160;y+=21){
- glColor3f(255,255,0);
- glBegin(GL_POLYGON);
- glVertex2i(399,y);
- glVertex2i(399+w,y);
- glVertex2i(399+w,y+h);
- glVertex2i(399,y+h);
- glEnd();
- }
- blackbox(399,42,w,h);
- blackbox(399,483,w,h);
- //20th Line 12
- for(y=147;y<300;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(420,y);
- glVertex2i(420+w,y);
- glVertex2i(420+w,y+h);
- glVertex2i(420,y+h);
- glEnd();
- }
- for(y=336;y<480;y+=21){
- glColor3f(255,255,0);
- glBegin(GL_POLYGON);
- glVertex2i(420,y);
- glVertex2i(420+w,y);
- glVertex2i(420+w,y+h);
- glVertex2i(420,y+h);
- glEnd();
- }
- blackbox(420,483,w,h);
- yellowbox(420,63,w,h);
- yellowbox(420,84,w,h);
- yellowbox(420,105,w,h);
- yellowbox(420,126,w,h);
- blackbox(420,42,w,h);
- blackbox(420,315,w,h);
- //21th Line 11
- for(y=126;y<320;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(441,y);
- glVertex2i(441+w,y);
- glVertex2i(441+w,y+h);
- glVertex2i(441,y+h);
- glEnd();
- }
- yellowbox(441,63,w,h);
- yellowbox(441,84,w,h);
- yellowbox(441,105,w,h);
- blackbox(441,42,w,h);
- blackbox(441,483,w,h);
- for(y=336;y<480;y+=21){
- glColor3f(255,255,0);
- glBegin(GL_POLYGON);
- glVertex2i(441,y);
- glVertex2i(441+w,y);
- glVertex2i(441+w,y+h);
- glVertex2i(441,y+h);
- glEnd();
- }
- //22th Line 10
- for(y=84;y<340;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(462,y);
- glVertex2i(462+w,y);
- glVertex2i(462+w,y+h);
- glVertex2i(462,y+h);
- glEnd();
- }
- yellowbox(462,63,w,h);
- blackbox(462,42,w,h);
- yellowbox(462,357,w,h);
- yellowbox(462,378,w,h);
- yellowbox(462,399,w,h);
- blackbox(462,420,w,h);
- yellowbox(462,441,w,h);
- yellowbox(462,462,w,h);
- blackbox(462,483,w,h);
- //23th Line 9
- for(y=105;y<440;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(483,y);
- glVertex2i(483+w,y);
- glVertex2i(483+w,y+h);
- glVertex2i(483,y+h);
- glEnd();
- }
- yellowbox(483,63,w,h);
- yellowbox(483,84,w,h);
- blackbox(483,42,w,h);
- yellowbox(483,441,w,h);
- yellowbox(483,462,w,h);
- blackbox(483,483,w,h);
- //24th Line 8
- for(y=105;y<440;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(504,y);
- glVertex2i(504+w,y);
- glVertex2i(504+w,y+h);
- glVertex2i(504,y+h);
- glEnd();
- }
- yellowbox(504,63,w,h);
- yellowbox(504,84,w,h);
- blackbox(504,42,w,h);
- yellowbox(504,441,w,h);
- yellowbox(504,462,w,h);
- blackbox(504,483,w,h);
- //25th Line 7
- for(y=126;y<400;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(525,y);
- glVertex2i(525+w,y);
- glVertex2i(525+w,y+h);
- glVertex2i(525,y+h);
- glEnd();
- }
- yellowbox(525,84,w,h);
- yellowbox(525,105,w,h);
- blackbox(525,63,w,h);
- yellowbox(525,420,w,h);
- yellowbox(525,441,w,h);
- blackbox(525,462,w,h);
- //26th Line 6
- for(y=147;y<380;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(546,y);
- glVertex2i(546+w,y);
- glVertex2i(546+w,y+h);
- glVertex2i(546,y+h);
- glEnd();
- }
- yellowbox(546,105,w,h);
- yellowbox(546,126,w,h);
- blackbox(546,84,w,h);
- yellowbox(546,399,w,h);
- yellowbox(546,420,w,h);
- blackbox(546,441,w,h);
- //27th Line 5
- for(y=168;y<360;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(567,y);
- glVertex2i(567+w,y);
- glVertex2i(567+w,y+h);
- glVertex2i(567,y+h);
- glEnd();
- }
- yellowbox(567,126,w,h);
- yellowbox(567,147,w,h);
- blackbox(567,105,w,h);
- yellowbox(567,378,w,h);
- yellowbox(567,399,w,h);
- blackbox(567,420,w,h);
- //28th Line 4
- for(y=189;y<340;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(588,y);
- glVertex2i(588+w,y);
- glVertex2i(588+w,y+h);
- glVertex2i(588,y+h);
- glEnd();
- }
- yellowbox(588,147,w,h);
- yellowbox(588,168,w,h);
- blackbox(588,126,w,h);
- yellowbox(588,357,w,h);
- yellowbox(588,378,w,h);
- blackbox(588,399,w,h);
- //29th Line 3
- for(y=210;y<320;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(609,y);
- glVertex2i(609+w,y);
- glVertex2i(609+w,y+h);
- glVertex2i(609,y+h);
- glEnd();
- }
- yellowbox(609,189,w,h);
- yellowbox(609,168,w,h);
- yellowbox(609,336,w,h);
- yellowbox(609,357,w,h);
- blackbox(609,378,w,h);
- blackbox(609,147,w,h);
- //30th Line 2
- for(y=189;y<340;y+=21){
- glColor3f(255,255,0);
- glBegin(GL_POLYGON);
- glVertex2i(630,y);
- glVertex2i(630+w,y);
- glVertex2i(630+w,y+h);
- glVertex2i(630,y+h);
- glEnd();
- }
- blackbox(630,168,w,h);
- blackbox(630,357,w,h);
- //31th Line 1
- for(y=189;y<340;y+=21){
- glColor3f(0,0,0);
- glBegin(GL_POLYGON);
- glVertex2i(651,y);
- glVertex2i(651+w,y);
- glVertex2i(651+w,y+h);
- glVertex2i(651,y+h);
- glEnd();
- }
- glFlush();
- }
- void init(void)
- {
- glClearColor(1.0, 0.0, 1.0, 0.0);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluOrtho2D(0,690,0,500);
- }
- int main(int argc, char** argv)
- {
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
- glutInitWindowSize(690, 500);
- glutInitWindowPosition(100, 100);
- glutCreateWindow("BATMAN");
- init();
- glutDisplayFunc(display);
- glutMainLoop();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement