Thursday, September 29, 2011

Figure 39


$40 off Craftsman 5 Drawer Homeowner Tool Center with Riser and Parts Bins $99.99 on sale 10/2-10/8
Sears Deal of the Day: Thule Car Top Carrier, Quest
Wholesale Fleece Blankets
400950_BuddhaGroove.com-Culture Infused Living: Home Accents, Jewelry, Accessories from around the world!
400948_Culture Infused Living: Home Accents, Jewelry, and accessories from around the world. CulturalElemen
504427_Save up to 75% on batteries and accessories at Brooklyn Battery Works!
504080_10% OFF Orders of $75 or More from Journelle.com! Use Promo Code: NOV11 (Valid 11/1 - 11/30/11)
502239_Brand names, bargain prices at shoezoo.com. If you don't love your new shoes, return them for free!

400949_GaneshMall.com-Culture Infused Living: Home Accents, Jewelry, and accessories from around the world!


Figure 39
===========================


/*
//Author: Cheikh Drame
//To support, please do one of the following
//- Visit irap123.com many times a day
//- Join irap123.com
//- Buy my app irap123 (rhyming dictionary) available for android, and iphone. On windows phone, it is called iLyrics. If not, you can get the desktop version at www.irap123.com/apps/webstore/
//- Include irap123.com in your blogs, forums, facebook walls, email footers, comments
//- send a donation at my paypal address at cbdsigned.vevo@gmail.com
//- Buy a story at http://shop.pparzygnat.com
*/

//CS732 Project 1-3
//
#include

void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
int x, y=0;
//create an Array which holds the shifting position for each row
int position[11]={-6,-12,6,10,3,-9,-3,-9,8,15,2};
//11 rows
for(int i=0;i<11;i++)
{
//x should be the starting x position for the first white square in each row
x=position[i]+50;
// 5 white squares we need to draw for each row
for(int j=0;j<5;j++)
{
//set the square color to be white
glColor3f(1.0,1.0,1.0);
//here should be black square first, since the background color is black, no need to draw.
//draw white square which the length of each side is 50.
glRecti(x,y,x+50,y+50);
//set the border's color to be gray
glColor3f(0.5,0.5,0.5);
glBegin(GL_LINES);
//draw left border for white square
glVertex2i(x,y);
glVertex2i(x,y+50);
//draw right border for white square
glVertex2i(x+50,y);
glVertex2i(x+50,y+50);
glEnd();
//get to the x position for next white square in the same row which is 50(side length of white square) + 50(side length of black square), so no change for y.
x=x+100;
}
//set the line's color to be gray
glColor3f(0.5,0.5,0.5);
//whenever finish drawing the squares in each row, draw a top border for this row
glBegin(GL_LINES);
glVertex2i(0,y);
glVertex2i(550,y);
glEnd();
//get the y position for next row, simply add the length of square's side
y=y+50;
}
glFlush();
}

void main(int argc, char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(550,550);
glutInitWindowPosition(200,100);
glutCreateWindow("Project 1 - The Cafe Wall Illusion by irap123.com");
//make the window to be black color
glClearColor(0.0,0.0,0.0,0.0);
gluOrtho2D(0.0,550.0,0.0,550.0);
glutDisplayFunc(display);
glutMainLoop();
}

No comments:

Post a Comment