$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 41
=======================
/*
//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
*/
// OpenGLtrial4_Lines.cpp : Defines the entry point for the console application.
//
#include
const int WIDTH=500, HEIGHT=400;
void line_strip()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0, 1, 0);
glBegin(GL_LINE_STRIP);//parallel lines
int x=100, y=10;
for(y; y
}
glColor3f(0, 0, 1);
x=300, y=10;
for(y; y
}
glEnd();
glFlush();
}
void line_loop()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0, 1, 0);
glBegin(GL_LINE_LOOP);//parallel lines
int x=100, y=10;
for(y; y
}
glColor3f(0, 0, 1);
x=300, y=10;
for(y; y
}
glEnd();
glFlush();
}
void line_loop2()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,1,1);
glBegin(GL_LINE_LOOP);
glVertex2i(200, 10); glVertex2i(300, 40); glVertex2i(200,50); glVertex2i(100,40);
glEnd();
glFlush();
}
void triangle_strip()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,1,1);
int v[5][2]={
{100,100},{50,50},{150,50},{150,100},{200,50}
};
glBegin(GL_TRIANGLE_STRIP);
for(int i=0; i<5; ++i)
glVertex2iv(v[i]);
glEnd();
glFlush();
}
void triangle_fan()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,1,1);
int v[5][2]={
{100,100},{50,50},{150,50},{150,100},{200,50}
};
glBegin(GL_TRIANGLE_FAN);
for(int i=0; i<5; ++i)
glVertex2iv(v[i]);
glEnd();
glFlush();
}
void lines()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0, 1, 0);
glBegin(GL_LINES);//parallel lines
int x=100, y=10;
for(y; y
}
glColor3f(0, 0, 1);
x=300, y=10;
for(y; y
}
glEnd();
glFlush();
}
void triangle_fan2()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,1,1);
int v[5][2]={
{100,100},{50,50},{150,50},{250,50},{200,50}
};
glBegin(GL_TRIANGLE_FAN);
for(int i=0; i<5; ++i)
glVertex2iv(v[i]);
glEnd();
glFlush();
}
void main(int argc, char**argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(WIDTH, HEIGHT);
glutInitWindowPosition(300,200);
glutCreateWindow("Lines, Lines, Lines... by irap123.com");
gluOrtho2D(0, WIDTH, HEIGHT, 0);
glutDisplayFunc(triangle_fan2);
glutMainLoop();
}
No comments:
Post a Comment