-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStar_1.cpp
More file actions
71 lines (54 loc) · 1.44 KB
/
Star_1.cpp
File metadata and controls
71 lines (54 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <GL/glut.h>
#include <math.h>
void line_join(float x1 , float y1 , float x2 , float y2){
glBegin(GL_LINES);
glVertex2f(x1,y1);
glVertex2f(x2,y2);
}
void cirlce()
{
float theta;
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glColor3f(1.0,1.0,1.0);
for(int i=0; i<1000; i++)
{
theta = i*3.142/180;
glVertex2f(0.125*cos(theta),0.125*sin(theta));
}
glEnd();
glFlush();
}
void displayMe(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINES);
glColor3f(0.0,1.0,1.0);
line_join(0.0, 1.0, -0.86, -0.50);
line_join(0.0, 1.0, 0.86, -0.50);
line_join(-0.86, -0.50, 0.86, -0.50);
glColor3f(1.0,0.0,1.0);
line_join(0.0, -1.0, 0.86, 0.50);
line_join(0.0, -1.0, -0.86, 0.50);
line_join(0.86, 0.50, -0.86, 0.50);
glColor3f(0.0,1.0,1.0);
line_join(0.0, 0.5, 0.43, -0.25);
line_join(0.0, 0.5, -0.43, -0.25);
line_join(0.43, -0.25, -0.43, -0.25);
glColor3f(1.0,0.0,1.0);
line_join(0.0, -0.250, 0.216, 0.125);
line_join(0.0, -0.250, -0.216, 0.125);
line_join(0.216, 0.125, -0.216, 0.125);
glColor3f(1.0,1.0,1.0);
cirlce();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB);
glutInitWindowSize(550, 550);
glutCreateWindow("Rakshit Star");
glutDisplayFunc(displayMe);
glutMainLoop();
return 0;
}