Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <glut.h>
- #include <cmath>
- const double pi = 3.1415926535897932384626433832795;
- const double r1 = 0.25;
- const double r2 = 0.5;
- const double base1 = -pi / 2;
- const double base2 = pi / 2;
- void Draw(){
- glClear( GL_COLOR_BUFFER_BIT);
- glBegin(GL_POLYGON);
- glColor3d(1, 1, 0);
- for(int i = 0; i < 5; i++){
- double a1, a2;
- a1 = base1 + i * 2 * pi / 5;
- a2 = base2 + (i+3) * 2 * pi / 5;
- glVertex2d( r1 * cos(a1), r1 * sin(a1) );
- glVertex2d( r2 * cos(a2), r2 * sin(a2) );
- }
- glEnd();
- glFlush();
- }
- int main(int argc, char ** argv){
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_SINGLE);
- glutInitWindowPosition(100, 100);
- glutInitWindowSize(500, 500);
- glutCreateWindow( " hello " );
- glutDisplayFunc( Draw );
- //glEnable(GL_CLIP_PLANE0);
- //double eq[] = {-1.8, -1.0, 0.0, 1.4};
- //glClipPlane(GL_CLIP_PLANE0, eq );
- //glEnable(GL_CLIP_PLANE1);
- //double eq1[] = {0.5, -0.9, 0.0, 0.2};
- //glClipPlane(GL_CLIP_PLANE1, eq1);
- glutMainLoop();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement