-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFish_Art.cpp
More file actions
84 lines (73 loc) · 1.45 KB
/
Fish_Art.cpp
File metadata and controls
84 lines (73 loc) · 1.45 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
72
73
74
75
76
77
78
79
80
81
82
83
84
#include<GL\glut.h>
#include<iostream>
#include<windows.h>
using namespace std;
void myInit()
{
glClearColor(0, 0.2, 0.2, .5);
glColor3f(1.0, 0.3, 0.9);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 400.0, 0.0, 400.0);
}
void Polygon()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glColor3f(0.0, 1.0, 0.0);
glVertex2i(40, 200);
glVertex2i(120, 280);
glColor3f(0.3, 0.3, 1.0);
glVertex2i(320, 200);
glColor3f(0.3, 0.5, 1.0);
glVertex2i(100, 160);
glEnd();
glPointSize(20);
glBegin(GL_POINT);
glColor3f(0.0, 0.0, 0.0);
glVertex2i(60, 200);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0, 1.0, 0.0);
glVertex2i(320, 200);
glVertex2i(360, 240);
glVertex2i(340, 200);
glVertex2i(360, 160);
glColor3f(0.0, 0.5, 0.5);
glVertex2i(320, 200);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0, 0.0, 0.0);
glVertex2i(120, 280);
glVertex2i(140, 300);
glVertex2i(280, 216);
glColor3f(0.0, 0.5, 0.5);
glVertex2i(120, 280);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0, 0.0, 0.0);
glVertex2i(100, 160);
glVertex2i(140, 200);
glVertex2i(120, 164);
glColor3f(0.0, 0.5, 0.5);
glVertex2i(100, 160);
glEnd();
glFlush();
}
void myDisplay()
{
Polygon();
glFlush();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(1200, 740);
glutInitWindowPosition(0, 0);
glutCreateWindow("Fish Art");
glutDisplayFunc(myDisplay);
myInit();
glutMainLoop();
return 0;
}