-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
59 lines (43 loc) · 1.16 KB
/
main.cpp
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
#include "GL/freeglut.h"
void renderScene(void);
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(100, 100);
glutInitWindowSize(600, 600);
glutCreateWindow("Lesson - Basic Forms");
glutDisplayFunc(renderScene);
glutMainLoop();
return 0;
}
void renderScene(void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_QUADS);
glColor3f(.245, .14, .0);
glVertex2f(.5,0);
glVertex2f(0.5, -65);
glVertex2f(-0.5, -65);
glVertex2f(-0.5, -0);
glBegin(GL_QUADS);
glColor3f(.35, .10, .10);
glVertex2f(.0, -.125);
glVertex2f(.45, -.125);
glVertex2f(.45, -.5);
glVertex2f(-0, -.5);
glBegin(GL_QUADS);
glColor3f(.3, .3, .3);
glVertex2f(-.375, -.25);
glVertex2f(-.125, -.25);
glVertex2f(-.125, -.65);
glVertex2f(-.375, -.65);
//âûâîä (ñáîðêà)
//end.
// 1. èçìåíèòü ïàðàìåòðû ôóíêöèé glVertex2f
// îáðàòèòü âíèìàíèå íà òî, ÷òî ìû ×ÒÎ-ÒÎ èçìåíÿåì â êîäå è ýòî îòðàæàåòñÿ â òîì, ÷òî ìû âèäèì
// 2. Äîáàâèòü õàðàêòåðèñòèêó âåðøèíû - å¸ öâåò
// glColor3f, RGB, 0..1
// 3. Äîáàâèòü åù¸ îäèí òðåóãîëüíèê
// 4. Ðèñóåì ìîðäó êîòà
glutSwapBuffers();
}