-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstar.cpp
More file actions
58 lines (49 loc) · 1.1 KB
/
star.cpp
File metadata and controls
58 lines (49 loc) · 1.1 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
#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 circle()
{
float theta;
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glColor3f(1.0,1.0,1.0);
for(int i=0; i<500; i++)
{
theta = i*3.142/180;
glVertex2f(200*cos(theta),200*sin(theta));
}
}
void displayMe(void)
{
glClearColor(0,0,0,0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,100,0,100);
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINES);
glColor3f(1.0,0.5,1.0);
line_join(50,97,5,25);
line_join(50,97,95,25);
line_join(5,25,95,25);
glColor3f(1.0,0.7,1.0);
line_join(50,3,5,75);
line_join(50,3,95,75);
line_join(5,75,95,75);
circle();
glEnd();
glFlush();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB);
glutInitWindowSize(500, 500);
glutCreateWindow("Rakshit Kapoor");
glutDisplayFunc(displayMe);
glutMainLoop();
return 0;
}