-
Notifications
You must be signed in to change notification settings - Fork 0
/
abdur.cpp
127 lines (101 loc) · 2.57 KB
/
abdur.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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#include "GL/glut.h"
#include<stdlib.h>
#include<math.h>
#include<unistd.h>
#include<curses.h>
#include<cstdio>
#include<iostream>
#include<string.h>
#include<sstream>
void drawvehicle(){
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glColor3f(0, 1, 0);
glTranslatef(0.97, 0.19, 0); //right path of road
glScalef(0.56, 1.925, 0);
glutSolidCube(2);
glLoadIdentity();
glColor3f(0, 1, 0);
glTranslatef(-0.97, 0.19, 0); //left path of road
glScalef(0.56, 1.925, 0);
glutSolidCube(2);
glLoadIdentity();
glColor3f(0.1f, 0.1f, 0.1f);
glTranslatef(-0.01, 0.19, 0); //left path of road
glScalef(0.37, 1.925, 0);
glutSolidCube(2);
///white loans accoors rooad
glLoadIdentity();
glColor3f(1, 1, 1);
glTranslatef(-0.01, 0.06, 0); //left path of road
glScalef(0.01, 0.3, 0);
glutSolidCube(0.7);
glLoadIdentity();
glColor3f(1, 1, 1);
glTranslatef(-0.01, 0.46, 0); //left path of road
glScalef(0.01, 0.3, 0);
glutSolidCube(0.7);
glLoadIdentity();
glColor3f(1, 1, 0);
glTranslatef(-0.01, -0.34, 0); //center path of road
glScalef(0.01, 0.3, 0);
glutSolidCube(0.7);
glLoadIdentity();
glColor3f(1, 1, 1);
glTranslatef(-0.01, -0.74, 0); //center path of road
glScalef(0.01, 0.3, 0);
glutSolidCube(0.7);
glLoadIdentity();
glColor3f(0, 0, 1);
glTranslatef(-0.01, -0.35, 0); //truck rear cube
glScalef(0.5, 0.5, 0);
glutSolidCube(0.7);
glLoadIdentity();
glColor3f(0, 0, 1);
glTranslatef(-0.01, -0.15, 0); //truck front cube
glScalef(0.4, 0.5, 0);
glutSolidCube(0.7);
glLoadIdentity();
glColor3f(0.5,0.5,0.5);
glTranslatef(-0.01, -0.35, 0); //rear cube inner black cube
glScalef(0.45, 0.45, 0);
glutSolidCube(0.7);
glLoadIdentity();
glColor3f(0, 0, 1);
glTranslatef(-0.01, -0.35, 0); //rear cube inner blue cube
glScalef(0.4, 0.4, 0);
glutSolidCube(0.7);
glLoadIdentity();
glColor3f(0.5,0.5,0.5);
glTranslatef(-0.01, -0.09, 0); //wind screen
glScalef(0.3, 0.15, 0);
glutSolidCube(0.7);
glLoadIdentity();
glColor3f(1,1,0);
glTranslatef(-0.1, 0.013, 0); //left light
glScalef(0.1,0.05,0);
glutSolidCube(0.7);
glLoadIdentity();
glColor3f(1, 1, 0);
glTranslatef(0.08, 0.013, 0); //right light
glScalef(0.1, 0.05, 0);
glutSolidCube(0.7);
glFlush();
}
void display()
{
drawvehicle();
glFlush();
}
int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("Racing Game");
glutIdleFunc(display);
glEnable(GL_DEPTH_TEST);
glutDisplayFunc(display);
glutMainLoop();
return 0;
}