$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

Figure 50
=========================
/*
//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
*/
// PyramidIllusion.cpp : Defines the entry point for the console application.
//author: Cheikh Drame
//class: Research
//focus: Computer Graphics using openGL
#include
#include
const int WIDTH=400, HEIGHT=400;
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3ub(100,110,100);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glBegin(GL_QUADS);
int x1=0, y1=HEIGHT, x2=WIDTH, y2=HEIGHT, x3=WIDTH, y3=0, x4=0, y4=0;
int red=0, green=0, blue=255;
const int CONSTANT=3;
while( (x3-x4)>=20 ){// the condition says 2 width is the least
glColor3ub(0, 0, blue);
glVertex2i(x1,y1); glVertex2i(x2,y2); glVertex2i(x3,y3); glVertex2i(x4,y4);
x1+=CONSTANT; y1-=CONSTANT;//this is to decrement the square according to CONSTANT
x2-=CONSTANT; y2-=CONSTANT;
x3-=CONSTANT; y3+=CONSTANT;
x4+=CONSTANT; y4+=CONSTANT;
red+=CONSTANT; green+=CONSTANT; blue-=(2*CONSTANT);// this is a way to decrease the hue of the color
}
glEnd();
glEnd();
glFlush();
}
void main(int argc, char**argv)
{
glutInit(&argc, argv);
// glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(WIDTH, HEIGHT);
glutInitWindowPosition(200,100);
glutCreateWindow("sample Prog: Points by irap123.com");
glClearColor(1.0,1.0,1.0,0.0);
gluOrtho2D(0.0, WIDTH, HEIGHT, 0.0);
glutDisplayFunc(display);
glutMainLoop();
}
No comments:
Post a Comment