-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathcarfinal.cpp
727 lines (619 loc) · 16 KB
/
carfinal.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
#include <stdio.h>
#include <stdlib.h>
#include <GL/glut.h>
#include <math.h>
#include <string.h>
#define ESCAPE 27
GLint window;
GLint window2;
GLint Xsize=1000;
GLint Ysize=800;
float i,theta;
GLint nml=0,day=1;
char name3[]="PROJECT: 3D CAR ANIMATION";
GLfloat xt=0.0,yt=0.0,zt=0.0,xw=0.0;
GLfloat xs=1.0,ys=1.0,zs=1.0;
GLfloat xangle=0.0,yangle=0.0,zangle=0.0,angle=0.0;
GLfloat r=0,g=0,b=1;
GLint light=1;
int count=1,flg=1;
int view=0;
int flag1=0,aflag=1; //to switch car driving mode
int flag2=0,wheelflag=0; //to switch fog effect
GLUquadricObj *t;
static void SpecialKeyFunc( int Key, int x, int y );
GLvoid Transform(GLfloat Width, GLfloat Height)
{
glViewport(0, 0, Width, Height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0,Width/Height,0.1,100.0);
glMatrixMode(GL_MODELVIEW);
}
GLvoid InitGL(GLfloat Width, GLfloat Height)
{
glClearColor(1.0, 1.0, 1.0, 1.0);
glLineWidth(2.0); /* Add line width, ditto */
Transform( Width, Height ); /* Perform the transformation */
t=gluNewQuadric();
gluQuadricDrawStyle(t, GLU_FILL);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
GLfloat ambientLight[] = { 0.2f, 0.2f, 0.2f, 1.0f };
GLfloat diffuseLight[] = { 0.8f, 0.8f, 0.8, 1.0f };
GLfloat specularLight[] = { 0.5f, 0.5f, 0.5f, 1.0f };
GLfloat position[] = { 1.5f, 1.0f, 4.0f, 1.0f };
glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);
glLightfv(GL_LIGHT0, GL_SPECULAR, specularLight);
glLightfv(GL_LIGHT0, GL_POSITION, position);
}
void init()
{
glClearColor(0,0,0,0);
glPointSize(5.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0,900.0,0.0,600.0,50.0,-50.0);
glutPostRedisplay();
}
void display_string(int x, int y, char *string, int font)
{
int len,i;
glColor3f(0.8,0.52,1.0);
glRasterPos2f(x, y);
len = (int) strlen(string);
for (i = 0; i < len; i++) {
if(font==1)
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,string[i]);
if(font==2)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,string[i]);
if(font==3)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12,string[i]);
if(font==4)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10,string[i]);
}
}
void display1(void)
{
glClearColor(1.0 ,1.0 ,1.0,1.0);
glClear(GL_COLOR_BUFFER_BIT);
display_string(190,540,"National Institute of Technology Karnataka, Surathkal",1);
display_string(225,500,name3,1);
display_string(390+10,470,"HELP",2);
display_string(10,450,"MOUSE",2);
display_string(10,410,"PRESS RIGHT BUTTON FOR MENU",3);
display_string(10,370,"KEYBOARD",2);
display_string(10,340,"X-Y-Z KEYS FOR CORRESPONDING ROTATION",3);
display_string(10,280+30,"U-F FOR CAMERA VIEW SETTINGS",3);
display_string(10,250+30,"USE LEFT ARROW(<-) AND RIGHT ARROW(->) TO MOVE CAR",3);
display_string(10,220+30,"ESCAPE TO EXIT",3);
display_string(250,150+30,"PRESS SPACE BAR TO ENTER",2);
glutPostRedisplay();
glutSwapBuffers();
}
GLvoid DrawGLScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if(view==0)
{
init();
display1();
}
else
{
if(count==1)
InitGL(Xsize,Ysize);
if(aflag==1)/* Initialize our window. */
glClearColor(1,1,1,1);
else
glClearColor(0.1,0.1,0.1,0);
glPushMatrix();
glLoadIdentity();
glTranslatef(-1.0,0.0,-3.5);
glRotatef(xangle,1.0,0.0,0.0);
glRotatef(yangle,0.0,1.0,0.0);
glRotatef(zangle,0.0,0.0,1.0);
glTranslatef(xt,yt,zt);
glScalef(xs,ys,zs);
glEnable(GL_COLOR_MATERIAL);
if(flag2==1)
{
GLfloat fogcolour[4]={1.0,1.0,1.0,1.0};
glFogfv(GL_FOG_COLOR,fogcolour);
glFogf(GL_FOG_DENSITY,0.1);
glFogi(GL_FOG_MODE,GL_EXP);
glFogf(GL_FOG_START,3.0);
glFogf(GL_FOG_END,100.0);
glHint(GL_FOG_HINT, GL_FASTEST);
glEnable(GL_FOG);
}
if(flag2==0)
{
glDisable(GL_FOG);
}
if(!aflag){
glBegin(GL_POINTS);
glColor3f(1,1,1);
glPointSize(200.0);
int ccount=0;
float x=10,y=10;
while(ccount<20)
{
glVertex2f(x,y);
x+=10;
y+=10;
if(y>Ysize) y-=10;
if(x>Xsize) x-=10;
ccount++;
}
glEnd();}
glColor3f(1.0,.75,0.0);
glPointSize(30.0);
glBegin(GL_POINTS);
glVertex3f(0.2,0.3,0.3);
glVertex3f(0.2,0.3,0.5);
glEnd();
glPointSize(200.0);
glBegin(GL_QUADS); /* OBJECT MODULE*/
/* top of cube*/
//************************FRONT BODY****************************************
glColor3f(r,g,b);
glVertex3f( 0.2, 0.4,0.6);
glVertex3f(0.6, 0.5,0.6);
glVertex3f(0.6, 0.5,0.2);
glVertex3f( 0.2,0.4,0.2);
/* bottom of cube*/
glVertex3f( 0.2,0.4,0.6);
glVertex3f(0.6,0.2,0.6);
glVertex3f(0.6,0.2,0.2);
glVertex3f( 0.2,0.2,0.2);
/* front of cube*/
glVertex3f( 0.2,0.2,0.6);
glVertex3f(0.2, 0.4,0.6);
glVertex3f(0.2,0.4,0.2);
glVertex3f( 0.2,0.2,0.2);
/* back of cube.*/
glVertex3f(0.6,0.2,0.6);
glVertex3f(0.6,0.5,0.6);
glVertex3f(0.6,0.5,0.2);
glVertex3f( 0.6,0.2,0.2);
/* left of cube*/
glVertex3f(0.2,0.2,0.6);
glVertex3f(0.6,0.2,0.6);
glVertex3f(0.6,0.5,0.6);
glVertex3f(0.2,0.4,0.6);
/* Right of cube */
glVertex3f(0.2,0.2,0.2);
glVertex3f( 0.6,0.2,0.2);
glVertex3f( 0.6,0.5,0.2);
glVertex3f( 0.2,0.4,0.2);
//****************************************************************************
glVertex3f(0.7,0.65,0.6);
glVertex3f(0.7,0.65,0.2);
glVertex3f(1.7,0.65,0.2); //top cover
glVertex3f(1.7,0.65,0.6);
//***************************back guard******************************
glColor3f(r,g,b); /* Set The Color To Blue*/
glVertex3f( 1.8, 0.5,0.6);
glVertex3f(1.8, 0.5,0.2);
glVertex3f(2.1, 0.4, 0.2);
glVertex3f(2.1,0.4,0.6);
/* bottom of cube*/
glVertex3f( 2.1,0.2,0.6);
glVertex3f(2.1,0.2,0.2);
glVertex3f(1.8,0.2,0.6);
glVertex3f( 1.8,0.2,0.6);
/* back of cube.*/
glVertex3f(2.1,0.4,0.6);
glVertex3f(2.1,0.4,0.2);
glVertex3f(2.1,0.2,0.2);
glVertex3f(2.1,0.2,0.6);
/* left of cube*/
glVertex3f(1.8,0.2,0.2);
glVertex3f(1.8,0.5,0.2);
glVertex3f(2.1,0.4,0.2);
glVertex3f(2.1,0.2,0.2);
/* Right of cube */
glVertex3f(1.8,0.2,0.6);
glVertex3f(1.8,0.5,0.6);
glVertex3f(2.1,0.4,0.6);
glVertex3f(2.1,0.2,0.6);
//******************MIDDLE BODY************************************
glVertex3f( 0.6, 0.5,0.6);
glVertex3f(0.6, 0.2,0.6);
glVertex3f(1.8, 0.2, 0.6);
glVertex3f(1.8,0.5,0.6);
/* bottom of cube*/
glVertex3f( 0.6,0.2,0.6);
glVertex3f(0.6,0.2,0.2);
glVertex3f(1.8,0.2,0.2);
glVertex3f( 1.8,0.2,0.6);
/* back of cube.*/
glVertex3f(0.6,0.5,0.2);
glVertex3f(0.6,0.2,0.2);
glVertex3f(1.8,0.2,0.2);
glVertex3f(1.8,0.5,0.2);
//*********************ENTER WINDOW**********************************
glColor3f(0.3,0.3,0.3);
glVertex3f( 0.77, 0.63,0.2);
glVertex3f(0.75, 0.5,0.2); //quad front window
glVertex3f(1.2, 0.5, 0.2);
glVertex3f( 1.22,0.63,0.2);
glVertex3f(1.27,0.63,.2);
glVertex3f(1.25,0.5,0.2); //quad back window
glVertex3f(1.65,0.5,0.2);
glVertex3f(1.67,0.63,0.2);
glColor3f(r,g,b);
glVertex3f(0.7,0.65,0.2);
glVertex3f(0.7,0.5,.2); //first separation
glVertex3f(0.75,0.5,0.2);
glVertex3f(0.77,0.65,0.2);
glVertex3f(1.2,0.65,0.2);
glVertex3f(1.2,0.5,.2); //second separation
glVertex3f(1.25,0.5,0.2);
glVertex3f(1.27,0.65,0.2);
glVertex3f(1.65,0.65,0.2);
glVertex3f(1.65,0.5,.2); //3d separation
glVertex3f(1.7,0.5,0.2);
glVertex3f(1.7,0.65,0.2);
glVertex3f( 0.75, 0.65,0.2);
glVertex3f(0.75, 0.63,0.2); //line strip
glVertex3f(1.7, 0.63, 0.2);
glVertex3f( 1.7,0.65,0.2);
glVertex3f( 0.75, 0.65,0.6);
glVertex3f(0.75, 0.63,0.6); //line strip
glVertex3f(1.7, 0.63, 0.6);
glVertex3f( 1.7,0.65,0.6);
glColor3f(0.3,0.3,0.3);
glVertex3f( 0.77, 0.63,0.6);
glVertex3f(0.75, 0.5,0.6); //quad front window
glVertex3f(1.2, 0.5, 0.6);
glVertex3f( 1.22,0.63,0.6);
glVertex3f(1.27,0.63,.6);
glVertex3f(1.25,0.5,0.6); //quad back window
glVertex3f(1.65,0.5,0.6);
glVertex3f(1.67,0.63,0.6);
glColor3f(r,g,b);
glVertex3f(0.7,0.65,0.6);
glVertex3f(0.7,0.5,.6); //first separation
glVertex3f(0.75,0.5,0.6);
glVertex3f(0.77,0.65,0.6);
glVertex3f(1.2,0.65,0.6);
glVertex3f(1.2,0.5,.6); //second separation
glVertex3f(1.25,0.5,0.6);
glVertex3f(1.27,0.65,0.6);
glVertex3f(1.65,0.65,0.6);
glVertex3f(1.65,0.5,.6);
glVertex3f(1.7,0.5,0.6);
glVertex3f(1.7,0.65,0.6);
glEnd();
//**************************************************************
glBegin(GL_QUADS);
/* top of cube*/
glColor3f(0.3,0.3,0.3);
glVertex3f( 0.6, 0.5,0.6);
glVertex3f(0.6, 0.5,0.2); //quad front window
glVertex3f(0.7, 0.65, 0.2);
glVertex3f( 0.7,0.65,0.6);
glVertex3f(1.7,0.65,.6);
glVertex3f(1.7,0.65,0.2); //quad back window
glVertex3f(1.8,0.5,0.2);
glVertex3f(1.8,0.5,0.6);
//*****************************road and surrounding development***********************************
if(flag1)
{
glPushMatrix();
glTranslatef(xw,0,0);
glColor3f(0,1,0);
glVertex3f(-100,0.1,-100);
glVertex3f(-100,0.1,0); //a green surroundings
glVertex3f(100,0.1,0);
glVertex3f(100,0.1,-100);
glColor3f(0.7,0.7,0.7);
glVertex3f(-100,0.1,0);
glVertex3f(-100,0.1,0.45); //a long road
glVertex3f(100,0.1,0.45);
glVertex3f(100,0.1,0);
glColor3f(1.0,0.75,0.0);
glVertex3f(-100,0.1,0.45); //a median
glVertex3f(-100,0.1,0.55);
glVertex3f(100,0.1,0.55);
glVertex3f(100,0.1,0.45);
glColor3f(0.7,0.7,0.7);
glVertex3f(-100,0.1,0.55);
glVertex3f(-100,0.1,1); //a long road
glVertex3f(100,0.1,1);
glVertex3f(100,0.1,0.55);
glColor3f(0,1,0);
glVertex3f(-100,0.1,1);
glVertex3f(-100,0.1,100); //a green surroundings
glVertex3f(100,0.1,100);
glVertex3f(100,0.1,1);
glPopMatrix();
}
glEnd();
if(wheelflag)
{
glPushMatrix();
glTranslatef(xw,0,0);
glColor3f(0.5,.2,0.3);
glBegin(GL_QUADS);
for(i=0;i<200;i+=0.2)
{
glVertex3f(-100+i,0,1);
glVertex3f(-99.9+i,0,1);
glVertex3f(-99.9+i,0.2,1);
glVertex3f(-100+i,0.2,1);
i+=0.5;
}
for(i=0;i<200;i+=0.2)
{
glVertex3f(-100+i,0,0);
glVertex3f(-99.9+i,0,0);
glVertex3f(-99.9+i,0.2,0);
glVertex3f(-100+i,0.2,0);
i+=0.5;
}
glEnd();
glPopMatrix();
}
//
glBegin(GL_TRIANGLES); /* start drawing the cube.*/
/* top of cube*/
glColor3f(0.3,0.3,0.3);
glVertex3f( 0.6, 0.5,0.6);
glVertex3f( 0.7,0.65,0.6); //tri front window
glVertex3f(0.7,0.5,0.6);
glVertex3f( 0.6, 0.5,0.2);
glVertex3f( 0.7,0.65,0.2); //tri front window
glVertex3f(0.7,0.5,0.2);
glVertex3f( 1.7, 0.65,0.2);
glVertex3f( 1.8,0.5,0.2); //tri back window
glVertex3f( 1.7,0.5,0.2);
glVertex3f( 1.7, 0.65,0.6);
glVertex3f( 1.8,0.5,0.6); //tri back window
glVertex3f(1.7,0.5,0.6);
glEnd();
//************IGNITION SYSTEM
glPushMatrix();
glColor3f(0.3,0.3,0.7);
glTranslatef(1.65,0.2,0.3);
glRotatef(90.0,0,1,0);
gluCylinder(t,0.02,0.03,.5,10,10);
glPopMatrix();
//********************WHEEL
glColor3f(0.7,0.7,0.7);
glPushMatrix();
glBegin(GL_LINE_STRIP);
for(theta=0;theta<360;theta=theta+40)
{
glVertex3f(0.6,0.2,0.62);
glVertex3f(0.6+(0.08*(cos(((theta+angle)*3.14)/180))),0.2+(0.08*(sin(((theta+angle)*3.14)/180))),0.62);
}
glEnd();
glBegin(GL_LINE_STRIP);
for(theta=0;theta<360;theta=theta+40)
{
glVertex3f(0.6,0.2,0.18);
glVertex3f(0.6+(0.08*(cos(((theta+angle)*3.14)/180))),0.2+(0.08*(sin(((theta+angle)*3.14)/180))),0.18);
}
glEnd();
glBegin(GL_LINE_STRIP);
for(theta=0;theta<360;theta=theta+40)
{
glVertex3f(1.7,0.2,0.18);
glVertex3f(1.7+(0.08*(cos(((theta+angle)*3.14)/180))),0.2+(0.08*(sin(((theta+angle)*3.14)/180))),0.18);
}
glEnd();
glBegin(GL_LINE_STRIP);
for(theta=0;theta<360;theta=theta+40)
{
glVertex3f(1.7,0.2,0.62);
glVertex3f(1.7+(0.08*(cos(((theta+angle)*3.14)/180))),0.2+(0.08*(sin(((theta+angle)*3.14)/180))),0.62);
}
glEnd();
glTranslatef(0.6,0.2,0.6);
glColor3f(0,0,0);
glutSolidTorus(0.025,0.07,10,25);
glTranslatef(0,0,-0.4);
glutSolidTorus(0.025,0.07,10,25);
glTranslatef(1.1,0,0);
glutSolidTorus(0.025,0.07,10,25);
glTranslatef(0,0,0.4);
glutSolidTorus(0.025,0.07,10,25);
glPopMatrix();
//*************************************************************
glPopMatrix();
glEnable(GL_DEPTH_TEST);
glutPostRedisplay();
glutSwapBuffers();
}
}
void NormalKey(GLubyte key, GLint x, GLint y)
{
switch ( key ) {
case ESCAPE : printf("escape pressed. exit.\n");
glutDestroyWindow(window);
exit(0);
break;
case ' ':view=1;
DrawGLScene();
break;
case 'x': xangle += 5.0;
glutPostRedisplay();
break;
case 'X':xangle -= 5.0;
glutPostRedisplay();
break;
case 'y':
yangle += 5.0;
glutPostRedisplay();
break;
case 'Y':
yangle -= 5.0;
glutPostRedisplay();
break;
case 'z':
zangle += 5.0;
glutPostRedisplay();
break;
case 'Z':
zangle -= 5.0;
glutPostRedisplay();
break;
case 'u': /* Move up */
yt += 0.2;
glutPostRedisplay();
break;
case 'U':
yt -= 0.2; /* Move down */
glutPostRedisplay();
break;
case 'f': /* Move forward */
zt += 0.2;
glutPostRedisplay();
break;
case 'F':
zt -= 0.2; /* Move away */
glutPostRedisplay();
break;
default:
break;
}
}
static void SpecialKeyFunc( int Key, int x, int y )
{
switch ( Key ) {
case GLUT_KEY_RIGHT:
if(!wheelflag)
xt += 0.2;
if(wheelflag)
{
angle+=5;
xw+=0.2;
}
glutPostRedisplay();
break;
case GLUT_KEY_LEFT:
if(!wheelflag)
xt -= 0.2;
if(wheelflag)
{
angle+=5;
xw-=0.2;
}
glutPostRedisplay();
break;
}
}
void myMenu(int id)
{
if (id==1)
{
flag1=0;
wheelflag=0;
glutPostRedisplay();
}
if(id ==2)
{
flag1=1;
flag2=0;
wheelflag=0;
xangle += 5.0;
glutPostRedisplay();
}
if (id==4)
{
wheelflag=1;
glutPostRedisplay();
}
if(id==12)
{
aflag=1;
day=1;
glClearColor(1,1,1,1);
glDisable(GL_FOG);
glutPostRedisplay();
}
if(id==13)
{
aflag=0;
day=0;
flag2=2;
glClearColor(0.1,0.1,0.1,0);
GLfloat fogcolour[4]={0.0,0.0,0.0,1.0};
glFogfv(GL_FOG_COLOR,fogcolour);
glFogf(GL_FOG_DENSITY,0.5);
glFogi(GL_FOG_MODE,GL_EXP);
glHint(GL_FOG_HINT, GL_FASTEST);
glEnable(GL_FOG);
glutPostRedisplay();
}
}
void colorMenu(int id)
{
if (id==6)
{
r=g=0;
b=1;
glutPostRedisplay();
}
if(id ==7)
{
r=0.8;
b=g=0;
glutPostRedisplay();
}
if(id==8)
{
g=1;
r=b=0;
glutPostRedisplay();
}
if (id==9)
{
r=b=g=0;
glutPostRedisplay();
}
if(id==10)
{
b=0;
r=g=1;
glutPostRedisplay();
}
if(id==11)
{
b=r=g=.7;
glutPostRedisplay();
}
}
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE|GLUT_DEPTH);
glutInitWindowSize(Xsize,Ysize);
glutInitWindowPosition(50,50);
glutCreateWindow("3D CAR ANIMATION");
glutDisplayFunc(DrawGLScene);
glutKeyboardFunc(NormalKey);
glutSpecialFunc( SpecialKeyFunc );
InitGL(Xsize,Ysize);
int submenu=glutCreateMenu(colorMenu);
glutAddMenuEntry("blue", 6);
glutAddMenuEntry("red", 7);
glutAddMenuEntry("green",8);
glutAddMenuEntry("black",9);
glutAddMenuEntry("yellow",10);
glutAddMenuEntry("grey",11);
glutCreateMenu(myMenu);
glutAddMenuEntry("car model mode", 1);
glutAddMenuEntry("car driving mode", 2);
glutAddMenuEntry("wheel effect",4);
glutAddSubMenu("car colors",submenu);
glutAddMenuEntry("daymode",12);
glutAddMenuEntry("Night mode",13);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutMainLoop();
return 1;
}