Thursday, September 29, 2011

Figure 51


$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 51
========================


/*
//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
*/
// RingCircle.cpp : Defines the entry point for the console application.
//

#include

int width=600, height=600;
GLfloat shield[5][3]={ {5,0,0}, {8,20,0}, {0,25,0}, {-8,20,0}, {-5,0,0}};//Data for shield
GLfloat colors[4][3]={ {1,0,0}, {0,1,0}, {0,0,1}, {1,1,0}};//color for rings

void draw_shield()//draw a shield using the current modelview matrix
{
glBegin(GL_POLYGON);
for(int i=0; i<5; ++i) glVertex3fv(shield[i]);
glEnd();
}
void draw_ring()
{
for(int r=0; r<360; r+=15){//position shield in 15 increment
glPushMatrix();//save a copy of the CTM that places the ring into image
glRotated(r,0,0,1);
glTranslated(0,50,0);
draw_shield();
glPopMatrix();

}
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

for(int i=0; i<4; ++i){//set up loop for 4 rings
glColor3fv(colors[i]);
//glPushMatrix();//save the copy of the identity matrix
//glTranslated( (i-3)*50, (i-3)*50, -i*5);
//glScaled(i+1, i+1, i+1);
draw_ring();
//glPopMatrix();
}
glFlush();
}
void main(int argc, char**argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB );
glutInitWindowSize(width, height);
glutInitWindowPosition(300,100);
glutCreateWindow("Rotation by irap123.com");
glClearColor(0.0, 0.0, 0.0, 0.0);
glEnable(GL_DEPTH_TEST);// enables the z-axis
glOrtho(-300,300,-300,300,0,100);
glutDisplayFunc(display);
glutMainLoop();
}

No comments:

Post a Comment