$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 27
=============================
/*
//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
*/
// HeringIllusion.cpp : Defines the entry point for the console application.
//author: Cheikh Drame
//class: Research
//focus: Computer Graphics using openGL
#include
#include
int width=600, height=600;
void display(void)
{
int midX=width/2, midY=height/2;
int start=midY*0.20;
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0,0.0,0.0);
int startUp=midY-start;//is the first line before the midX
int startDown=midY+start;//is the first line ref after the midX
glBegin(GL_LINES);
int constantDistance=10; //this specifies the constant distance
while( startUp>=0){//this loop draws the line on the sides
glVertex2i(0,startUp); glVertex2i(width, startDown);
glVertex2i(width, startUp); glVertex2i(0, startDown);
startDown+=constantDistance;
startUp-=constantDistance;
}
int startUpX=0+constantDistance, startDownX=width-constantDistance;
while(startUpX<=width){//this loop draws the lines on the x-axis
glVertex2i(startUpX, 0); glVertex2i(startDownX, height);
startUpX+=constantDistance;
startDownX-=constantDistance;
}
glVertex2i(0, midY-start+5); glVertex2i(width, midY-start+5);//these are the two parallel lines
glVertex2i(0, midY+start-5); glVertex2i(width, midY+start-5);
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