/
Scene.c
723 lines (622 loc) · 16.2 KB
/
Scene.c
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
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>
#include <stdio.h>
/* Viewing setup and camera mechanics
y
|
|
|_ _ _ x
/
/ xz plane of movement (strafe, forward, backward)
/
z
Camera pan is rotation about y-axis and xz-plane.
Camera zoom is achieved through changing field of view angle in perspective.
Camera roll is rotation about the camera vector.
2D Movement happens only in XZ-plane at constant Y, so we consider only XZ components of the camera vector.
Strafing is achieved by moving along vectors perpendicular to XZ component of camera vector.
Moving upward and downward is done by moving along Y-axis.
Moving forward and backward is moving along the XZ component of the camera vector.
*/
// Angles of rotation for the camera direction
// XZangle is the angle made by the camera vector projected on XZ plane with the x-axis
// Y angle is the angle made by the camera vector with the XZ plane (or 90-angle made with Y axis)
// axis angle is the rotation about the camera vector (used for roll)
float XZangle = 0.0f;
float Yangle = 0.0f;
float axisangle = 0.0f;
// Camera position in 3D space
float x = 0.0f;
float z = 5.0f;
float y = 1.0f;
// Actual vector representing the camera's direction
float vx = 0.0f;
float vz = -1.0f;
float vy = 0.0f;
// the key states. These variables will be zero
//when no key is being presses
float deltaXZangle = 0.0f;
float deltaYangle = 0.0f;
float deltaMove = 0;
int xOrigin = -1;
int yOrigin = -1;
int lstrafe = 0;
int rstrafe = 0;
// rollamount and fov control the degree of camera roll and zoom respectively
float rollamount = 0;
float fov = 45.0;
// Active global color
float r,g,b;
// To handle window resizing
void changeSize(int w, int h)
{
// Compute the aspect ratio
float ratio = w*1.0/h;
// Projection matrix incorporate perspective projection
// with perspective angle = fov
// This helps maintain zoom degree across all window sizes
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, w, h);
gluPerspective(fov, ratio, 0.1f, 100.0f);
glMatrixMode(GL_MODELVIEW);
}
void drawParapetX(float len)
{
glColor3f(r,g,b);
glBegin(GL_QUADS);
int h;
for(h=0;h<8;h++)
{
glNormal3f(0.0f, 0.0f, 1.0f);
glVertex3f(0.6f, 0.1+h*0.3, 0.0f);
glVertex3f(0.6f, 0.1+h*0.3, len);
glVertex3f(0.6f, 0.3+h*0.3, len);
glVertex3f(0.6f, 0.3+h*0.3, 0.0f);
glNormal3f(1.0f, 0.0f, 0.0f);
glVertex3f(0.0f, 0.1+h*0.3, len);
glVertex3f(0.0f, 0.3+h*0.3, len);
glVertex3f(0.6f, 0.3+h*0.3, len);
glVertex3f(0.6f, 0.1+h*0.3, len);
glNormal3f(0.0f, 0.0f, -1.0f);
glVertex3f(0.0f, 0.1+h*0.3, 0.0f);
glVertex3f(0.0f, 0.3+h*0.3, 0.0f);
glVertex3f(0.0f, 0.3+h*0.3, len);
glVertex3f(0.0f, 0.1+h*0.3, len);
glNormal3f(-1.0f, 0.0f, 0.0f);
glVertex3f(0.0f, 0.1+h*0.3, 0.0f);
glVertex3f(0.6f, 0.1+h*0.3, 0.0f);
glVertex3f(0.6f, 0.3+h*0.3, 0.0f);
glVertex3f(0.0f, 0.3+h*0.3, 0.0f);
}
glEnd();
}
void drawDoorX()
{
glColor3f(r,g,b);
glBegin(GL_QUADS);
//Front
glNormal3f(0.0f, 0.0f, 1.0f);
glVertex3f(0.6f, -1.0f, 0.0f);
glVertex3f(0.6f, -1.0f, 4.0f);
glVertex3f(0.6f, 5.0f, 4.0f);
glVertex3f(0.6f, 5.0f, 0.0f);
//Right
glNormal3f(1.0f, 0.0f, 0.0f);
glVertex3f(0.0f, -1.0f, 4.0f);
glVertex3f(0.0f, 5.0f, 4.0f);
glVertex3f(0.6f, 5.0f, 4.0f);
glVertex3f(0.6f, -1.0f, 4.0f);
//Back
glNormal3f(0.0f, 0.0f, -1.0f);
glVertex3f(0.0f, -1.0f, 0.0f);
glVertex3f(0.0f, 5.0f, 0.0f);
glVertex3f(0.0f, 5.0f, 4.0f);
glVertex3f(0.0f, -1.0f, 4.0f);
//Left
glNormal3f(-1.0f, 0.0f, 0.0f);
glVertex3f(0.0f, -1.0f, 0.0f);
glVertex3f(0.6f, -1.0f, 0.0f);
glVertex3f(0.6f, 5.0f, 0.0f);
glVertex3f(0.0f, 5.0f, 0.0f);
glEnd();
}
void drawDoorZ()
{
glColor3f(r,g,b);
glBegin(GL_QUADS);
//Front
glNormal3f(0.0f, 0.0f, 1.0f);
glVertex3f(0.0f, -1.0f, 0.6f);
glVertex3f(4.0f, -1.0f, 0.6f);
glVertex3f(4.0f, 5.0f, 0.6f);
glVertex3f(0.0f, 5.0f, 0.6f);
//Right
glNormal3f(1.0f, 0.0f, 0.0f);
glVertex3f(4.0f, -1.0f, 0.0f);
glVertex3f(4.0f, 5.0f, 0.0f);
glVertex3f(4.0f, 5.0f, 0.6f);
glVertex3f(4.0f, -1.0f, 0.6f);
//Back
glNormal3f(0.0f, 0.0f, -1.0f);
glVertex3f(0.0f, -1.0f, 0.0f);
glVertex3f(0.0f, 5.0f, 0.0f);
glVertex3f(4.0f, 5.0f, 0.0f);
glVertex3f(4.0f, -1.0f, 0.0f);
//Left
glNormal3f(-1.0f, 0.0f, 0.0f);
glVertex3f(0.0f, -1.0f, 0.0f);
glVertex3f(0.0f, -1.0f, 0.6f);
glVertex3f(0.0f, 5.0f, 0.6f);
glVertex3f(0.0f, 5.0f, 0.0f);
glEnd();
}
void drawWallZ(float len)
{
glColor3f(r,g,b);
glBegin(GL_QUADS);
//Front
glNormal3f(0.0f, 0.0f, 1.0f);
glVertex3f(0.0f, -1.0f, 0.6f);
glVertex3f(len, -1.0f, 0.6f);
glVertex3f(len, 5.0f, 0.6f);
glVertex3f(0.0f, 5.0f, 0.6f);
//Right
glNormal3f(1.0f, 0.0f, 0.0f);
glVertex3f(len, -1.0f, 0.0f);
glVertex3f(len, 5.0f, 0.0f);
glVertex3f(len, 5.0f, 0.6f);
glVertex3f(len, -1.0f, 0.6f);
//Back
glNormal3f(0.0f, 0.0f, -1.0f);
glVertex3f(0.0f, -1.0f, 0.0f);
glVertex3f(0.0f, 5.0f, 0.0f);
glVertex3f(len, 5.0f, 0.0f);
glVertex3f(len, -1.0f, 0.0f);
//Left
glNormal3f(-1.0f, 0.0f, 0.0f);
glVertex3f(0.0f, -1.0f, 0.0f);
glVertex3f(0.0f, -1.0f, 0.6f);
glVertex3f(0.0f, 5.0f, 0.6f);
glVertex3f(0.0f, 5.0f, 0.0f);
glEnd();
}
void drawWallX(float len)
{
glColor3f(r,g,b);
glBegin(GL_QUADS);
//Front
glNormal3f(0.0f, 0.0f, 1.0f);
glVertex3f(0.6f, -1.0f, 0.0f);
glVertex3f(0.6f, -1.0f, len);
glVertex3f(0.6f, 5.0f, len);
glVertex3f(0.6f, 5.0f, 0.0f);
//Right
glNormal3f(1.0f, 0.0f, 0.0f);
glVertex3f(0.0f, -1.0f, len);
glVertex3f(0.0f, 5.0f, len);
glVertex3f(0.6f, 5.0f, len);
glVertex3f(0.6f, -1.0f, len);
//Back
glNormal3f(0.0f, 0.0f, -1.0f);
glVertex3f(0.0f, -1.0f, 0.0f);
glVertex3f(0.0f, 5.0f, 0.0f);
glVertex3f(0.0f, 5.0f, len);
glVertex3f(0.0f, -1.0f, len);
//Left
glNormal3f(-1.0f, 0.0f, 0.0f);
glVertex3f(0.0f, -1.0f, 0.0f);
glVertex3f(0.6f, -1.0f, 0.0f);
glVertex3f(0.6f, 5.0f, 0.0f);
glVertex3f(0.0f, 5.0f, 0.0f);
glEnd();
}
// Compute new position of camera in world
// due to movement
// deltaMove allows for both positive and negative movement
// with its sign.
void computePos(float deltaMove)
{
// If the current camera vector along ground is vxi + vzj
// the left and right perpendicular vectors will be -vxi + vzj and vxi - vzj
if(lstrafe)
x += vz * 0.5f, z += (-vx) * 0.5f;
else if(rstrafe)
x += (-vz) * 0.5f, z += vx * 0.5f;
// Move on camera vector along ground - vxi + vzj
else
x += deltaMove * vx * 0.5f, z += deltaMove * vz * 0.5f;
}
// Main drawing function
void renderScene(void)
{
// Compute position if we move forward or left or right
if (deltaMove || lstrafe || rstrafe)
computePos(deltaMove);
// Clear color and set background to blue sky
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(102.0/255.0, 204.0/255.0, 1.0f, 1.0f);
// Sets up viewing
// Eye is at recorded position x, y, z
// We are looking in the direction vx, vy, vz
// The up vector is in y direction
glLoadIdentity();
gluLookAt( x, y, z,
x+vx, y+vy, z+vz,
0.0f, 1.0f, 0.0f );
// Roll the camera as required by roll amount
glTranslatef(x,y,z);
glRotatef(rollamount, vx, vy, vz);
glTranslatef(-x, -y, -z);
// Draw green grass
glColor3f(0.0f, 0.65f, 0.0f);
glBegin(GL_QUADS);
glVertex3f(-100.0f, 0.0f, -100.0f);
glVertex3f(-100.0f, 0.0f, 100.0f);
glVertex3f( 100.0f, 0.0f, 100.0f);
glVertex3f( 100.0f, 0.0f, -100.0f);
glEnd();
// Drawing walls and doors
//Door
r = 0.7, g = 0.3, b = 0.3;
glPushMatrix();
glTranslatef(29.6,0,30);
drawDoorZ();
glPopMatrix();
//Door attached wall
r = 1.0, g = 1.0, b = 1.0;
glPushMatrix();
glTranslatef(33,0,30.6);
drawWallX(10);
glPopMatrix();
//Door attached wall
glPushMatrix();
glTranslatef(26.6,0,30);
drawWallZ(3);
glPopMatrix();
//Living room wall
glPushMatrix();
glTranslatef(26.6,0,30);
drawWallX(-5);
glPopMatrix();
//Long living room wall
glPushMatrix();
glTranslatef(26.6,0,25);
drawWallZ(-30);
glPopMatrix();
//Balcony to hall living room connector
glPushMatrix();
glTranslatef(-3.4,0,40);
drawWallZ(15);
glPopMatrix();
//Balcony parapet
r = 0.0, g = 0.0, b = 0.0;
glPushMatrix();
glTranslatef(-9.6,0,25.65);
drawParapetX(14.2);
glPopMatrix();
r = 1.0, g = 1.0, b = 1.0;
//Balcony wall
glPushMatrix();
glTranslatef(-3.4,0,25);
drawWallZ(-6);
glPopMatrix();
//Balcony wall
glPushMatrix();
glTranslatef(-3.4,0,40);
drawWallZ(-6);
glPopMatrix();
//Balcony slide doors
glPushMatrix();
glTranslatef(-3.4,0,25);
drawWallX(6);
glPopMatrix();
//Balcony slide doors
glPushMatrix();
glTranslatef(-3.4,0,34);
drawWallX(6);
glPopMatrix();
//Shoebox wall
glPushMatrix();
glTranslatef(33,0,40);
drawWallZ(-6);
glPopMatrix();
//Hall wall to bathroom
glPushMatrix();
glTranslatef(27,0,40);
drawWallX(15);
glPopMatrix();
//Hall wall
glPushMatrix();
glTranslatef(11.6,0,40);
drawWallX(25);
glPopMatrix();
//Bathroom Door
r = 0.7, g = 0.3, b = 0.3;
glPushMatrix();
glTranslatef(27,0,55);
drawDoorX();
glPopMatrix();
//Bedroom bathroom separator
r = 1.0, g = 1.0, b = 1.0;
glPushMatrix();
glTranslatef(27,0,59);
drawWallX(1);
glPopMatrix();
//Bathroom walls
r = 0.0, g = 0.0, b = 0.9;
glPushMatrix();
glTranslatef(27.6,0,59);
drawWallZ(10);
glPopMatrix();
//Bathroom walls
glPushMatrix();
glTranslatef(27.6,0,49);
drawWallZ(10);
glPopMatrix();
//Bathroom walls
glPushMatrix();
glTranslatef(37.6,0,59);
drawWallX(-10);
glPopMatrix();
//Bedroom walls
r = 1.0, g = 1.0, b = 1.0;
glPushMatrix();
glTranslatef(27.6,0,59.6);
drawWallZ(10);
glPopMatrix();
//Bedroom walls
glPushMatrix();
glTranslatef(37.6,0,59);
drawWallX(10);
glPopMatrix();
//Bedroom walls
glPushMatrix();
glTranslatef(27.6,0,69);
drawWallZ(10);
glPopMatrix();
//Bedroom walls
glPushMatrix();
glTranslatef(27.6,0,69);
drawWallX(-4.8);
glPopMatrix();
//Bathroom Door
r = 0.7, g = 0.3, b = 0.3;
glPushMatrix();
glTranslatef(27.6,0,60.2);
drawDoorX();
glPopMatrix();
//Bedroom kitchen separator
r = 1.0, g = 1.0, b = 1.0;
glPushMatrix();
glTranslatef(27.6,0,69);
drawWallZ(-5);
glPopMatrix();
//Kitchen walls
glPushMatrix();
glTranslatef(22.6,0,69);
drawWallX(15);
glPopMatrix();
//Kitchen walls
glPushMatrix();
glTranslatef(22.6,0,84);
drawWallZ(-7);
glPopMatrix();
//Kitchen walls
glPushMatrix();
glTranslatef(15.6,0,84);
drawWallX(-15);
glPopMatrix();
//Kitchen bedroom separator
glPushMatrix();
glTranslatef(15.6,0,69);
drawWallZ(-2);
glPopMatrix();
//Bedroom 2 walls
glPushMatrix();
glTranslatef(13.6,0,69);
drawWallX(15);
glPopMatrix();
//Bedroom 2 walls
glPushMatrix();
glTranslatef(13.6,0,84);
drawWallZ(-15);
glPopMatrix();
//Bedroom 2 walls
glPushMatrix();
glTranslatef(-2.6,0,84);
drawWallX(-15);
glPopMatrix();
//Bedroom 2 walls
glPushMatrix();
glTranslatef(-2.6,0,69);
drawWallZ(12);
glPopMatrix();
//Bedroom Door
r = 0.7, g = 0.3, b = 0.3;
glPushMatrix();
glTranslatef(9.6,0,69);
drawDoorZ();
glPopMatrix();
//Bathroom 2 walls
r = 1.0, g = 1.0, b = 1.0;
glPushMatrix();
glTranslatef(5.6,0,65);
drawWallZ(-13);
glPopMatrix();
//Bathroom 2 walls
glPushMatrix();
glTranslatef(-7.4,0,65);
drawWallX(-6);
glPopMatrix();
//Bathroom 2 walls
glPushMatrix();
glTranslatef(-7.4,0,59);
drawWallZ(19);
glPopMatrix();
//Bathroom 2 walls
glPushMatrix();
glTranslatef(9.6,0,65);
drawWallZ(2);
glPopMatrix();
//Bathroom 2 Door
r = 0.7, g = 0.3, b = 0.3;
glPushMatrix();
glTranslatef(5.59,0,65);
drawDoorZ();
glPopMatrix();
//Bedroom 3 walls
r = 1.0, g = 1.0, b = 1.0;
glPushMatrix();
glTranslatef(-7.4,0,59);
drawWallZ(-6);
glPopMatrix();
//Bedroom 3 walls
glPushMatrix();
glTranslatef(-13.4,0,59);
drawWallX(25);
glPopMatrix();
//Bedroom 3 walls
glPushMatrix();
glTranslatef(-13.4,0,84);
drawWallZ(15);
glPopMatrix();
//Bedroom 3 Door
r = 0.7, g = 0.3, b = 0.3;
glPushMatrix();
glTranslatef(-2.6,0,65);
drawDoorX();
glPopMatrix();
glPushMatrix();
glTranslatef(-30,0,-30);
glPopMatrix();
glutSwapBuffers();
}
void processNormalKeys(unsigned char key, int xx, int yy)
{
// Exit the game
if(key == 27)
exit(0);
// Movement upward and downward
if(key == 'W')
y+=0.5;
if(key == 'S')
y-=0.5;
// Camera roll limited between -45° to 45°
if(key == 'M')
if(rollamount>-45)
rollamount-=1;
if(key == 'N')
if(rollamount<45)
rollamount+=1;
}
// Forward and backward movement, strafing keys
void pressKey(int key, int xx, int yy)
{
switch (key)
{
case GLUT_KEY_UP : deltaMove = 0.8f; break;
case GLUT_KEY_DOWN : deltaMove = -0.8f; break;
case GLUT_KEY_RIGHT: rstrafe = 1; break;
case GLUT_KEY_LEFT: lstrafe = 1; break;
}
}
// Reset all key effects
void releaseKey(int key, int x, int y)
{
switch (key)
{
case GLUT_KEY_UP :
case GLUT_KEY_DOWN : deltaMove = 0; break;
case GLUT_KEY_LEFT : lstrafe = 0; break;
case GLUT_KEY_RIGHT : rstrafe = 0; break;
}
}
// Change the camera vector if pan is performed
void mouseMove(int x, int y)
{
// If xOrigin is positive => We have panned across XZ plane
// i.e rotation along y-axis. This rotation is also called yaw.
if(xOrigin >= 0)
{
deltaXZangle = (x - xOrigin) * 0.010f;
vx = sin(XZangle + deltaXZangle);
vz = -cos(XZangle + deltaXZangle);
}
// If xOrigin is positive => We have panned across y-axis
// i.e rotation along camera vector. This rotation is also called pitch.
if(yOrigin >= 0)
{
deltaYangle = (yOrigin - y) * 0.006f;
vy = sin(Yangle + deltaYangle);
}
}
// Zoom and pan control
void mouseButton(int button, int state, int x, int y)
{
// Left button used for panning of camera
if(button == GLUT_LEFT_BUTTON)
{
// If pressed, the mouse cursor controls the panning
// xOrigin and yOrigin store last known position of cursor
if(state == GLUT_UP)
{
XZangle += deltaXZangle, xOrigin = -1;
Yangle += deltaYangle, yOrigin = -1;
}
else
xOrigin = x, yOrigin = y;
}
// button = 3 or 4 is triggered by mouse wheel up and down
// This is used to control zoom
if (button == 3 || button == 4)
{
// Increase or decrease zoom using mouse wheel
// Zoom is controlled by changing fov angle
// Small fov angle or smaller fov => High zoom
// Large fov angle or larger fov => Low zoom
if(fov >= 1.0f && fov <= 45.0f)
fov += (button==3)?(-1):(1);
if(fov <= 1.0f)
fov = 1.0f;
if(fov >= 45.0f)
fov = 45.0f;
// Set up perspective projection again to reflect FOV change
int w = glutGet(GLUT_WINDOW_WIDTH);
int h = glutGet(GLUT_WINDOW_HEIGHT);
float ratio = w * 1.0 / h;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, w, h);
gluPerspective(fov, ratio, 0.1f, 100.0f);
glMatrixMode(GL_MODELVIEW);
}
}
int main(int argc, char **argv)
{
// Initialize the window with depth, double buffering and RGBA colors
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("The Middle of Nowhere");
// Enable depth calculations
glEnable(GL_DEPTH_TEST);
// renderScene will be our main drawing routine invoked everytime
glutDisplayFunc(renderScene);
glutIdleFunc(renderScene);
// If the window is resized
glutReshapeFunc(changeSize);
// Keyboard event processing
glutIgnoreKeyRepeat(1);
glutKeyboardFunc(processNormalKeys);
glutSpecialFunc(pressKey);
glutSpecialUpFunc(releaseKey);
// Mouse event processing
glutMouseFunc(mouseButton);
glutMotionFunc(mouseMove);
// Start the scene
glutMainLoop();
return 0;
}