-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfigures.cpp
More file actions
78 lines (64 loc) · 1.4 KB
/
figures.cpp
File metadata and controls
78 lines (64 loc) · 1.4 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
//
// Created by petar on 27.7.19..
//
#include "figures.h"
void car()
{
GLfloat size = 0.2;
GLfloat wheel_init = 0.1;
// vozilo
glPushMatrix();
glColor3f(0, 0, 0);
glTranslatef(0, 0.1, 0);
glutWireCube(size);
glPopMatrix();
// prednji tockovi
glPushMatrix();
glColor3f(1, 0, 1);
glTranslatef(-wheel_init, 0, -wheel_init);
// levi tocak
glutWireSphere(0.05, 10, 10);
glTranslatef(2 * wheel_init, 0, 0);
// desni tocak
glutWireSphere(0.05, 10, 10);
glPopMatrix();
// zadnji tockovi
glPushMatrix();
glTranslatef(-wheel_init, 0, wheel_init);
// levi tocak
glutWireSphere(0.05, 10, 10);
glTranslatef(2 * wheel_init, 0, 0);
// desni tocak
glutWireSphere(0.05, 10, 10);
glPopMatrix();
}
void coordinates()
{
glBegin(GL_LINES);
// draws red x-axis
glColor3f(1, 0, 0);
glVertex3f(10, 0, 0);
glVertex3f(-10, 0, 0);
// draws green y-axis
glColor3f(0, 1, 0);
glVertex3f(0, 10, 0);
glVertex3f(0, -10, 0);
// draws blue z-axis
glColor3f(0, 0, 1);
glVertex3f(0, 0, 10);
glVertex3f(0, 0, -10);
glEnd();
}
void ground()
{
//ground
glPushMatrix();
glColor3d(30, 30, 0);
glBegin(GL_POLYGON);
glVertex3f(10, -0.05, 10);
glVertex3f(10, -0.05, -10);
glVertex3f(-10, -0.05, -10);
glVertex3f(-10, -0.05, 10);
glEnd();
glPopMatrix();
}