-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDrawPrimitives.cpp
More file actions
92 lines (80 loc) · 2.38 KB
/
Copy pathDrawPrimitives.cpp
File metadata and controls
92 lines (80 loc) · 2.38 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
85
86
87
88
89
90
91
92
//
// DrawPrimitives.cpp
// SimonSays
//
#include "DrawPrimitives.hpp"
#include <iostream>
void drawCube() {
// FRONT
glBegin(GL_POLYGON);
glVertex3f( 0.5, -0.5, -0.5 );
glVertex3f( 0.5, 0.5, -0.5 );
glVertex3f( -0.5, 0.5, -0.5 );
glVertex3f( -0.5, -0.5, -0.5 );
glEnd();
// BACK
glBegin(GL_POLYGON);
glVertex3f( 0.5, -0.5, 0.5 );
glVertex3f( 0.5, 0.5, 0.5 );
glVertex3f( -0.5, 0.5, 0.5 );
glVertex3f( -0.5, -0.5, 0.5 );
glEnd();
// RIGHT
glBegin(GL_POLYGON);
glVertex3f( 0.5, -0.5, -0.5 );
glVertex3f( 0.5, 0.5, -0.5 );
glVertex3f( 0.5, 0.5, 0.5 );
glVertex3f( 0.5, -0.5, 0.5 );
glEnd();
// LEFT
glBegin(GL_POLYGON);
glVertex3f( -0.5, -0.5, 0.5 );
glVertex3f( -0.5, 0.5, 0.5 );
glVertex3f( -0.5, 0.5, -0.5 );
glVertex3f( -0.5, -0.5, -0.5 );
glEnd();
// TOP
glBegin(GL_POLYGON);
glVertex3f( 0.5, 0.5, 0.5 );
glVertex3f( 0.5, 0.5, -0.5 );
glVertex3f( -0.5, 0.5, -0.5 );
glVertex3f( -0.5, 0.5, 0.5 );
glEnd();
// BOTTOM
glBegin(GL_POLYGON);
glVertex3f( 0.5, -0.5, -0.5 );
glVertex3f( 0.5, -0.5, 0.5 );
glVertex3f( -0.5, -0.5, 0.5 );
glVertex3f( -0.5, -0.5, -0.5 );
glEnd();
glFlush();
}
void drawButton(int const colorId, int const highlightColorId){
glScalef(0.03, 0.03, 0.03);
if(colorId==COLOR_RED)
glColor4f( 1.0, (highlightColorId == COLOR_RED ? 1 : 0.0), (highlightColorId == COLOR_RED ? 1 : 0.0), 1.0 );
else if(colorId==COLOR_GREEN)
glColor4f( (highlightColorId == COLOR_GREEN ? 1 : 0.0), 1.0, (highlightColorId == COLOR_GREEN ? 1 : 0.0), 1.0 );
else if(colorId==COLOR_BLUE)
glColor4f( (highlightColorId == COLOR_BLUE ? 1 : 0.0), (highlightColorId == COLOR_BLUE ? 1 : 0.0), 1.0, 1.0 );
else if(colorId==COLOR_YELLOW)
glColor4f( 1.0, 1.0, (highlightColorId == COLOR_YELLOW ? 1 : 0.0), 1.0 );
else if(colorId==START_MARKER)
glColor4f( 0.0, 1.0, 1.0, 1.0 );
drawCube();
}
void drawHeart(){
//glRotatef(90, 0, 1, 0);
glBegin(GL_POLYGON);
glColor4f(1, 0, 0, 1);
glVertex3f(0, -0.15, 0.5);//bottom
glVertex3f(-0.2, 0.1, 0.5);
glVertex3f(-0.18, 0.16, 0.5);
glVertex3f(-0.1, 0.2, 0.5);
glVertex3f(0, 0.15, 0.5);
glVertex3f(0.1, 0.2, 0.5);
glVertex3f(0.18, 0.16, 0.5);
glVertex3f(0.2, 0.1, 0.5);
glEnd();
glFlush();
}