File: glviewer.cpp

package info (click to toggle)
fox 1.0.52-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 10,788 kB
  • ctags: 13,384
  • sloc: cpp: 96,482; sh: 8,338; ansic: 1,935; makefile: 1,010; perl: 32
file content (851 lines) | stat: -rw-r--r-- 43,781 bytes parent folder | download
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
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
/********************************************************************************
*                                                                               *
*                         OpenGL Application coding sample                      *
*                                                                               *
*********************************************************************************
* Copyright (C) 1998 by Jeroen van der Zijp.   All Rights Reserved.             *
*********************************************************************************
* $Id: glviewer.cpp,v 1.44 2001/11/02 06:07:19 jeroen Exp $                     *
********************************************************************************/
#include "fx.h"
#include "fx3d.h"
#include <stdio.h>

#define SHARE_CONTEXT

#ifdef HAVE_OPENGL


// Front view
const unsigned char frontview[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x64,0x00,0xf4,0xa4,0x60,0x00,0xff,0x00,0xff,0xff,0xff,0x00,0x80,0x00,0xff,
  0xff,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x42,0x08,0x0a,0x11,0xfb,0xb0,0xc9,0x29,0x5f,0x10,0x4d,0xe8,0x8d,0x2d,0xbe,0x9c,
  0xe6,0x2c,0x60,0xb8,0x8d,0x24,0x35,0x41,0x43,0x40,0xbc,0xf0,0x8b,0x02,0x43,0x1b,
  0xc7,0xe8,0x44,0x48,0xbb,0x3b,0x15,0x40,0xdf,0xae,0xb7,0x03,0x1a,0x0b,0x42,0x17,
  0x2c,0x70,0x0c,0xaa,0x24,0x4d,0xa3,0x61,0x1a,0xad,0x4e,0x0d,0xd5,0xe8,0x35,0xdb,
  0xdc,0x56,0x13,0x00,0x3b
  };

// Back view
const unsigned char backview[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x64,0x00,0xf4,0xa4,0x60,0x00,0xff,0x00,0xff,0xff,0xff,0x00,0x80,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x41,0x08,0xba,0x1c,0xc1,0xca,0xc9,0x29,0x9b,0xb8,0x38,0xbf,0x15,0xb2,0x17,0x5b,
  0xf4,0x69,0x10,0x35,0x0d,0x10,0x10,0x10,0x6c,0x4b,0x0c,0x70,0xe9,0xb2,0x70,0xad,
  0x4a,0x84,0x93,0xaf,0xb5,0x53,0xfc,0x2b,0x9d,0xae,0xf6,0x2b,0xae,0x66,0x30,0x01,
  0xac,0x58,0x30,0x49,0x04,0xcc,0xa8,0x14,0x2a,0xad,0x16,0xa8,0xd6,0x28,0x36,0x5b,
  0x4d,0x00,0x00,0x3b
  };

// Top view
const unsigned char topview[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0x00,0x80,0x00,
  0x00,0xff,0x00,0x00,0x00,0x00,0xf4,0xa4,0x60,0xa5,0x2a,0x2a,0xff,0xff,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x38,0x08,0xba,0xdc,0x1b,0x2e,0x82,0x40,0x25,0xa3,0xd8,0x3e,0xc1,0xbb,0xe7,0x8c,
  0x30,0x8c,0x64,0x29,0x84,0x65,0x3a,0x9c,0x8b,0x40,0xbc,0x70,0xcc,0x2a,0x2e,0x17,
  0xc3,0x33,0x20,0x72,0xea,0x8a,0xf6,0xa3,0xdc,0x67,0x98,0x5b,0x14,0x8e,0x1a,0x23,
  0x32,0x09,0x38,0x16,0x98,0xcd,0xa5,0x23,0x01,0x00,0x3b
  };

// Bottom view
const unsigned char bottomview[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf1,0x00,0x00,0x80,0x80,0x80,
  0xa9,0xa9,0xa9,0x00,0x64,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,
  0x10,0x00,0x00,0x02,0x2f,0x84,0x11,0x79,0xcb,0xa8,0xdd,0x52,0x80,0xf1,0x51,0x20,
  0xb2,0xde,0x79,0x09,0x09,0x4a,0x82,0x17,0x86,0xe3,0xf1,0x95,0x22,0xa9,0x26,0xe7,
  0x94,0xb6,0x2f,0xd6,0xba,0x47,0xc0,0xe5,0xa7,0x73,0x2d,0x13,0xd2,0x33,0xfc,0x7e,
  0xc1,0xe2,0xa1,0x00,0x00,0x3b
  };

// Left view
const unsigned char leftview[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x64,0x00,0xf4,0xa4,0x60,0x00,0xff,0x00,0xff,0xff,0xff,0x00,0x80,0x00,0xff,
  0xff,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x42,0x08,0xba,0x1b,0xfc,0x2c,0x48,0x08,0x83,0x10,0x8e,0xb6,0x7b,0x33,0xb5,0x5c,
  0x07,0x0d,0x80,0x64,0x9a,0xcf,0xa0,0x06,0x44,0xeb,0x7a,0x80,0x2a,0x13,0x66,0x0b,
  0x07,0x32,0xab,0xdb,0x67,0x91,0xd3,0x12,0x5b,0x61,0xe8,0x93,0x0d,0x5c,0x2f,0x22,
  0x51,0x50,0x38,0x9d,0x0c,0x50,0xc3,0x90,0xa9,0xac,0x56,0xa9,0xd6,0x2c,0x36,0xcb,
  0xed,0x0e,0x13,0x00,0x3b
  };

// Right view
const unsigned char rightview[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x64,0x00,0xf4,0xa4,0x60,0x00,0xff,0x00,0xff,0xff,0xff,0x00,0x80,0x00,0xff,
  0xff,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x42,0x08,0xba,0xb1,0xfe,0x2c,0x34,0x08,0x83,0x10,0x93,0x2a,0x7b,0xb1,0x1a,0x55,
  0xd7,0x05,0x43,0xf9,0x48,0x28,0x5a,0x82,0x4e,0x40,0xbc,0x30,0x29,0xb0,0xcc,0x8b,
  0x12,0x8d,0xb0,0xa5,0x36,0x8e,0x5b,0x92,0x82,0xb0,0xe0,0xfa,0xb9,0x02,0x05,0xc1,
  0x70,0x58,0x84,0xe1,0x96,0x86,0xa8,0x21,0x95,0x5a,0x5a,0xaf,0xd8,0xac,0x76,0xcb,
  0xcd,0x26,0x00,0x00,0x3b
  };


const unsigned char foxicon[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0x7f,0x7f,0x7f,0xa9,0xa9,0xa9,0xff,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x37,0x08,0xba,0xdc,0xfe,0x30,0xae,0x40,0x29,0xa8,0xca,0xd6,0xb0,0x04,0x0f,0x02,
  0x30,0x7c,0x23,0x27,0x9a,0xd7,0x70,0xad,0x98,0x37,0x85,0xeb,0x65,0xba,0x19,0x6c,
  0x5a,0xe7,0xa4,0x7e,0x72,0xf7,0x85,0xa3,0x14,0x2e,0x83,0xd3,0xa0,0x24,0x0f,0x82,
  0x72,0x49,0x40,0x3a,0x9f,0xd0,0x45,0x02,0x00,0x3b
  };


// Palette of colors
const unsigned char colorpal[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0x80,0x80,0x80,
  0x00,0x00,0x00,0xff,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0x00,0x00,
  0x00,0xff,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x47,0x08,0x0a,0xd1,0xfb,0x30,0x88,0xe9,0xe0,0x92,0x33,0x07,0xcb,0xf2,0xf8,0xd4,
  0xd3,0x64,0xc2,0x37,0x48,0x55,0x83,0x11,0x04,0x83,0x09,0x9b,0x23,0xb1,0x2d,0x49,
  0x6d,0xdd,0x42,0xc6,0x68,0x67,0xdf,0x23,0x58,0xa7,0x40,0x7c,0x05,0x85,0x12,0x62,
  0xe1,0x65,0xc3,0xa1,0x24,0x86,0x68,0x54,0x73,0xc9,0x48,0x0d,0x54,0xd1,0xf1,0x66,
  0x91,0xa9,0x70,0x11,0x30,0x07,0x90,0x00,0x00,0x3b
  };

// Save as
const unsigned char filesaveas[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf3,0x00,0x00,0x80,0x80,0x80,
  0xb2,0xc0,0xdc,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x00,
  0x00,0xff,0x00,0xff,0xff,0x00,0x00,0x80,0xc0,0xc0,0xc0,0x00,0x80,0x80,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,
  0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x04,0x5a,0x10,0xc8,0x19,0xaa,0xbd,0x40,0x0c,
  0x91,0xc1,0xfd,0xc0,0x36,0x10,0x24,0xf1,0x59,0x99,0x58,0x4c,0x2c,0xba,0x19,0x5a,
  0x26,0xcc,0x9c,0x17,0x64,0xc6,0x01,0xcb,0x74,0x77,0xe7,0x07,0x9d,0x0c,0xc6,0x99,
  0x49,0x04,0x40,0x1d,0x12,0xd1,0x29,0x85,0x90,0x41,0xdd,0x81,0x39,0x4b,0x24,0x08,
  0x29,0x68,0x94,0x4a,0xc3,0x8a,0xb4,0x53,0x9e,0x00,0x5b,0x4a,0x86,0x69,0xe3,0x89,
  0x01,0xc1,0x6e,0x8b,0x4d,0x16,0x85,0x02,0x3b,0x41,0xc3,0x31,0x68,0xfb,0x09,0x50,
  0xea,0x93,0x22,0x00,0x3b
  };

// File Save
const unsigned char filesave[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x80,0x80,0x80,0xff,0xff,0xff,0x00,
  0x00,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x42,0x08,0xaa,0xb1,0xfe,0x4c,0x34,0x06,0xa3,0x90,0x20,0xcc,0x1a,0xae,0xc4,0x95,
  0x75,0x6d,0x8f,0xa6,0x79,0x64,0xa6,0x0d,0x44,0x87,0x9a,0x0c,0xc1,0x9a,0xb4,0x3c,
  0x05,0x33,0xad,0xd7,0x43,0x50,0x0c,0xbf,0x20,0x10,0xb8,0x6a,0x0d,0x85,0x42,0x8d,
  0x11,0x79,0xec,0x65,0x7a,0x4c,0x64,0x23,0xb0,0x6c,0x26,0x55,0xd6,0xe6,0x6d,0xc7,
  0x55,0x24,0x00,0x00,0x3b
  };


// File Open
const unsigned char fileopen[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0x00,0xff,0x00,0xff,0xff,0x00,0x80,0x80,0x80,0xff,0xff,0xff,0x00,
  0x00,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x45,0x08,0xba,0x1c,0xfe,0x2c,0xae,0x20,0x44,0x90,0x91,0xd6,0x8b,0x95,0xb6,0x1c,
  0x00,0x79,0x95,0x25,0x3e,0x03,0x31,0x3c,0xa5,0x73,0xaa,0xf0,0xda,0xae,0x5e,0xfa,
  0xdc,0xb8,0xa3,0x06,0xc5,0xd0,0xff,0x3e,0x9f,0xc3,0x16,0x04,0x02,0x75,0x81,0xa2,
  0xb2,0x77,0x49,0xf2,0x96,0xc5,0x26,0x21,0x69,0x54,0x36,0xa9,0x50,0xa6,0xe7,0x59,
  0xfd,0x71,0x72,0x60,0x4e,0x02,0x00,0x3b
  };

// Print
const unsigned char print[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0xff,0xff,0xff,0xc0,0xc0,0xc0,0x80,0x80,0x80,0x00,0x80,0x80,0x00,
  0x00,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x49,0x08,0x0a,0xd1,0xbd,0x10,0x06,0x41,0x5f,0x94,0x62,0xea,0xbb,0x66,0x75,0x1c,
  0x93,0x09,0x43,0x19,0x84,0x1e,0x55,0x5d,0x8e,0x40,0x04,0x6f,0x66,0x29,0x41,0x91,
  0xaa,0xf5,0x49,0x3b,0x7c,0x7f,0x06,0x25,0x92,0x70,0x30,0x24,0x35,0x0a,0xc8,0xa4,
  0x52,0x79,0xb4,0x39,0x99,0x35,0x5b,0x74,0x49,0x95,0xfa,0xae,0x8f,0x1a,0xa1,0xb0,
  0xed,0x72,0xb9,0xba,0x17,0xd6,0x41,0x00,0x24,0x00,0x00,0x3b
  };


// Zoom
const unsigned char zoom[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xbf,0xbf,0xbf,
  0x80,0x80,0x80,0x00,0x00,0x00,0xc0,0xc0,0xc0,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x4a,0x08,0x1a,0xd2,0x1d,0x2a,0xc6,0x17,0x46,0x60,0x42,0x2a,0x51,0x89,0x1d,0x20,
  0x23,0x31,0x03,0x61,0x82,0x28,0x37,0x05,0xa6,0x87,0x96,0xe2,0x66,0xb9,0x2f,0x98,
  0x6d,0x55,0x0d,0x7a,0x37,0x20,0x7c,0x3a,0xde,0x4a,0x57,0x22,0xc4,0x00,0xa4,0xda,
  0x49,0x35,0x6c,0x9d,0x18,0x10,0xc9,0x03,0x85,0x81,0x6a,0x30,0x8e,0x0b,0x87,0xa9,
  0xb9,0x0a,0x08,0xdc,0x6e,0x84,0x01,0x16,0x77,0xa1,0x09,0x00,0x3b
  };



// File new
const unsigned char filenew[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0xff,0xff,0x00,0xff,0xff,0xff,0x80,0x80,0x80,0x00,0x00,0x00,0xc0,0xc0,0xc0,0x00,
  0x00,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x48,0x08,0x0a,0xb1,0xfe,0xab,0x41,0x28,0x18,0xa8,0xd3,0x85,0x3d,0xfa,0x80,0x5b,
  0x28,0x0e,0x44,0x16,0x16,0x82,0x30,0x08,0xe5,0xa3,0x06,0x68,0xba,0xb2,0xd0,0x10,
  0x08,0x31,0x49,0xec,0x8f,0x9d,0xfe,0x85,0x20,0xe1,0xb3,0xf0,0xfd,0x8e,0x43,0xc7,
  0xec,0xf8,0x4b,0x16,0x99,0x48,0xa2,0x62,0x09,0x75,0x4e,0xa1,0x4d,0x29,0x40,0xb7,
  0xeb,0x76,0xb5,0x5b,0x8f,0xd8,0x03,0x48,0x00,0x00,0x3b
  };

// Cut
const unsigned char cut[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf1,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,
  0x10,0x00,0x00,0x02,0x29,0x84,0x8f,0xa9,0x10,0xd7,0xeb,0x22,0x34,0x8f,0x4d,0xda,
  0x42,0x9d,0xf9,0x3a,0xed,0x49,0xa1,0x10,0x08,0x21,0x60,0x0a,0xea,0xa4,0xa6,0x86,
  0xa9,0xc0,0x2e,0xba,0xc8,0xf4,0x9d,0xd8,0x28,0x5c,0xf3,0xe7,0x54,0x00,0x00,0x3b
  };

// Copy
const unsigned char copy[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf1,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0xff,0xff,0xff,0x00,0x00,0x80,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,
  0x10,0x00,0x00,0x02,0x38,0x84,0x8f,0x69,0xc1,0xad,0x18,0x84,0x14,0xec,0xad,0x49,
  0xa9,0x8d,0x8c,0x8e,0x0f,0x42,0x98,0x30,0x60,0xdf,0xc1,0x35,0xe5,0x54,0x0e,0x97,
  0x49,0x45,0xa0,0x9b,0x32,0xeb,0x48,0xe3,0x71,0x43,0x02,0x8d,0x3a,0x92,0xb8,0x14,
  0xa5,0x9f,0xec,0x71,0x33,0x21,0x67,0x33,0x8b,0xf3,0x99,0x28,0x00,0x00,0x3b
  };


// Paste
const unsigned char paste[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0xff,0xff,0x00,0xc0,0xc0,0xc0,0x80,0x80,0x00,0x80,0x80,0x80,0x00,
  0x00,0x80,0xff,0xff,0xff,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x4b,0x08,0xba,0xdc,0x1e,0x30,0x38,0x15,0xa1,0x10,0x55,0x52,0x52,0x48,0xc0,0x5f,
  0xd0,0x15,0x9a,0x48,0x0e,0x68,0x2a,0x7a,0x1b,0x99,0x41,0x05,0x49,0x8d,0x5c,0x4d,
  0x97,0x36,0x61,0xec,0xbc,0x51,0xd2,0x05,0xc3,0x61,0x38,0xdc,0xb5,0x6a,0x42,0xe2,
  0x41,0x68,0x00,0xac,0x46,0xc2,0xc8,0x92,0x17,0xc8,0x25,0x95,0xc5,0x27,0x27,0x9a,
  0x59,0x3a,0x2b,0x57,0x6c,0xb3,0xd1,0x2b,0x8f,0x27,0x93,0x04,0x00,0x3b
  };


// Property
const unsigned char prop[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0x00,0x00,0x80,0xc0,0xc0,0xc0,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x42,0x08,0xba,0xdc,0xae,0x21,0x4a,0x20,0x84,0x0b,0x23,0xeb,0x50,0x1b,0xc6,0x5a,
  0x56,0x49,0xd1,0xf0,0x85,0xc3,0x48,0x10,0xe7,0x99,0x71,0x42,0xc0,0x9a,0xf3,0x17,
  0x51,0x31,0x2b,0xaf,0x1f,0xcb,0xec,0xab,0xe0,0x2e,0xf0,0x0b,0x1a,0x85,0xc5,0x88,
  0x4e,0xe2,0x5b,0x00,0x8f,0xbc,0xa4,0x8c,0x34,0x2d,0x42,0x91,0x4e,0xaa,0xf6,0xc1,
  0x6d,0x24,0x00,0x00,0x3b
  };

// Delete
const unsigned char killobject[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf0,0x00,0x00,0xb2,0xc0,0xdc,
  0xff,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x02,0x24,0x84,
  0x8f,0x79,0xc1,0xba,0xcb,0x82,0x6a,0x28,0x4a,0xe8,0x40,0x34,0x34,0xdb,0x9b,0x71,
  0x5d,0xf8,0x85,0x1a,0x35,0x56,0x63,0x7a,0x82,0x8f,0xca,0x6a,0xb0,0x59,0x99,0x2e,
  0x8d,0x2b,0x05,0x00,0x3b
  };

// No shading
const unsigned char nolight[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0xc0,0xc0,0xc0,0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,
  0x00,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x33,0x08,0x1a,0xac,0xfe,0x2e,0x88,0x19,0x20,0x94,0x02,0x57,0xbb,0xb2,0xdf,0x9c,
  0x24,0x66,0x5c,0x24,0x82,0x25,0xc0,0xa0,0x69,0x30,0xb0,0x0f,0x11,0xbd,0x1c,0x61,
  0x9b,0xb0,0x7d,0x3b,0x85,0xa5,0xef,0xa5,0x1f,0xb0,0x26,0x4c,0x09,0x87,0x90,0xa3,
  0x2c,0x65,0x49,0x00,0x00,0x3b
  };

// Shading
const unsigned char light[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0xff,0xff,0x00,0xff,0xff,0xff,0x80,0x80,0x00,0x00,0x00,0xff,0x80,
  0x80,0x80,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x34,0x08,0x10,0xac,0xfe,0x2e,0x88,0x19,0x20,0x94,0x62,0x50,0x1b,0xb3,0xaf,0xdc,
  0xe2,0x69,0x60,0xc8,0x08,0x4d,0x18,0xa5,0xaa,0x12,0x10,0xa5,0x55,0x14,0x2e,0xcc,
  0xcd,0xb3,0xcb,0x3a,0x78,0xae,0x18,0xb2,0x1e,0x2d,0x24,0xf4,0xdd,0x8a,0xc4,0xe2,
  0x30,0x88,0x6c,0x41,0x12,0x00,0x3b
  };

// Smooth shading
const unsigned char smoothlight[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0xff,0xff,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x80,0x80,0x00,0x00,
  0x00,0xff,0x80,0x80,0x80,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x41,0x08,0x10,0xac,0xfe,0x2e,0x88,0x19,0x20,0x94,0x62,0x50,0x1b,0xb3,0xaf,0x16,
  0xb1,0x78,0x1a,0xf8,0x10,0xe8,0x22,0x35,0x9c,0xa8,0x30,0x20,0xea,0x2a,0x73,0x50,
  0xc4,0xb3,0x62,0x18,0xef,0x4d,0x03,0xae,0xdd,0xee,0xc5,0x72,0x10,0x84,0x43,0xc5,
  0xc1,0x82,0x4c,0x72,0x9a,0xce,0x9f,0x0e,0x7a,0x92,0x41,0xa3,0xc0,0x29,0x95,0xc3,
  0x4d,0x00,0x00,0x3b
  };

// Parallel projection
const unsigned char parallel[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf1,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0xff,0xff,0xff,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,
  0x10,0x00,0x00,0x02,0x31,0x84,0x6f,0x11,0xc8,0xa7,0xa0,0x56,0x83,0x12,0xa6,0x4a,
  0x19,0x8e,0x6f,0x66,0x25,0x08,0x9d,0x53,0x81,0xa1,0xb8,0x8c,0xd7,0x79,0x62,0x24,
  0x1b,0x4a,0xa3,0xc9,0x6e,0x69,0x00,0x8b,0x0d,0x07,0xdb,0x08,0x2d,0x73,0xbd,0x22,
  0x9e,0x9f,0xb0,0x58,0x2c,0x00,0x00,0x3b
  };

// Perspective projection
const unsigned char perspective[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf1,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0xff,0xff,0xff,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,
  0x10,0x00,0x00,0x02,0x2d,0x84,0x8f,0xa9,0x10,0xbb,0x01,0xa1,0x33,0xad,0x51,0x9b,
  0x2c,0xbe,0x08,0x6f,0x26,0x31,0xdd,0x11,0x56,0x1f,0x38,0x06,0x42,0x79,0x56,0xc2,
  0x1b,0xa2,0x14,0xf3,0xae,0x8a,0xa4,0xa9,0x27,0x47,0x46,0xbe,0x3f,0x09,0x0a,0x87,
  0x8b,0x02,0x00,0x3b
  };

// New folder
const unsigned char newfolder[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf1,0x00,0x00,0xb2,0xc0,0xdc,
  0x00,0x00,0x00,0xff,0xff,0x00,0xff,0xff,0xff,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,
  0x10,0x00,0x00,0x02,0x30,0x84,0x8f,0xa9,0x19,0xeb,0xbf,0x1a,0x04,0xf2,0x54,0x1a,
  0xb2,0x69,0x1c,0x05,0x31,0x80,0x52,0x67,0x65,0xe6,0xb9,0x51,0x54,0xc8,0x82,0xe2,
  0xf5,0xb5,0x2d,0xb9,0xba,0xf2,0xb8,0xd9,0xfa,0x55,0xcb,0x22,0xa3,0x9b,0x31,0x4e,
  0x44,0xde,0x24,0x51,0x00,0x00,0x3b
  };

const unsigned char penguin[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x12,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0x80,0x80,0x80,0x00,0x00,0x00,0xc0,0xc0,0xc0,0x10,0x10,0x10,0xff,0xff,0xff,0xe0,
  0xa0,0x08,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x12,0x00,0x00,0x03,
  0x53,0x08,0xba,0x21,0x12,0x2b,0xc6,0xe6,0x9e,0x94,0x62,0x64,0x77,0xa3,0x20,0x4e,
  0x21,0x74,0x8b,0x60,0x9c,0x1a,0xa9,0x98,0xa8,0x45,0xb2,0x85,0x38,0x76,0x4f,0x6c,
  0xbb,0x93,0x60,0xdb,0x0d,0xe4,0xd9,0x83,0x1d,0xe7,0x57,0x18,0x04,0x6f,0xb8,0x4c,
  0xec,0x88,0x9c,0x01,0x0c,0x47,0x66,0xac,0xa2,0x38,0x19,0x76,0x36,0x83,0xc3,0xf0,
  0xb4,0x5e,0x77,0x03,0xaf,0xf8,0x7b,0x13,0x77,0xad,0xd3,0xad,0x75,0x61,0xa5,0x54,
  0x02,0x27,0x45,0x02,0x00,0x3b
  };


// Application icon
const unsigned char winapp[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0xb2,0xc0,0xdc,
  0x80,0x80,0x80,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xff,0xff,0x00,
  0x00,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x38,0x08,0xba,0xdc,0x10,0x30,0xca,0x09,0x85,0xbd,0xf8,0x86,0x11,0x04,0xf9,0x60,
  0xf8,0x6d,0x9d,0x48,0x14,0x03,0x8a,0x92,0x02,0xe5,0x72,0x42,0x21,0xcf,0xb4,0xcc,
  0xd6,0x78,0x71,0xe7,0xf4,0xce,0xdb,0xb0,0xdf,0xcc,0xf7,0x23,0xf2,0x48,0xae,0xd7,
  0x60,0xc9,0x6c,0x3a,0x07,0x8e,0xe8,0x22,0x01,0x00,0x3b
  };


// Camera picture
const unsigned char camera[]={
  0x47,0x49,0x46,0x38,0x37,0x61,0x10,0x00,0x10,0x00,0xf2,0x00,0x00,0x00,0x00,0x00,
  0xc0,0xc0,0xc0,0xff,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x03,
  0x29,0x18,0xba,0xdc,0xfe,0x8d,0xc8,0x49,0x60,0x00,0x38,0xe7,0xa7,0x3b,0x07,0x42,
  0x07,0x2c,0x98,0x82,0x85,0xa2,0x66,0xa6,0xe2,0x8a,0x0d,0xec,0x78,0x65,0xf0,0xb6,
  0xba,0xad,0x13,0x7f,0xb9,0xe5,0xff,0xc0,0x5f,0x02,0x00,0x3b
  };

/*******************************************************************************/


// Main Window
class GLViewWindow : public FXMainWindow {
  FXDECLARE(GLViewWindow)
private:
  FXToolbar         *toolbar;                 // Tool bar
  FXMenubar         *menubar;                 // Menu bar
  FXMDIClient       *mdiclient;               // MDI Client area
  FXStatusbar       *statusbar;               // Status bar
  FXGLGroup         *scene;                   // Scene to watch
  FXGIFIcon         *mdiicon;                 // MDI Child window icon
  FXMenuPane        *mdimenu;                 // MDI Window Menu
  FXGLVisual        *glvisual;                // Visual for OpenGL
  FXMenuPane        *filemenu;
  FXMenuPane        *editmenu;
  FXMenuPane        *viewmenu;
  FXMenuPane        *rendermenu;
  FXMenuPane        *windowmenu;
  FXMenuPane        *helpmenu;
#ifdef SHARE_CONTEXT
  FXGLContext       *glcontext;               // Context for OpenGL
#endif
protected:
  GLViewWindow(){}
public:

  // We define additional ID's, starting from the last one used by the base class+1.
  // This way, we know the ID's are all unique for this particular target.
  enum{
    ID_ABOUT=FXMainWindow::ID_LAST,
    ID_OPEN,
    ID_NEWVIEWER,
    ID_QUERY_MODE,
    ID_GLVIEWER
    };

  // Message handlers
  long onCmdOpen(FXObject*,FXSelector,void*);
  long onCmdNewViewer(FXObject*,FXSelector,void*);
  long onCmdAbout(FXObject*,FXSelector,void*);
  long onUpdMode(FXObject*,FXSelector,void*);
  long onQueryMenu(FXObject*,FXSelector,void*);

public:

  // GLViewWindow constructor
  GLViewWindow(FXApp* a);

  // Initialize
  virtual void create();

  // GLViewWindow destructor
  virtual ~GLViewWindow();
  };


/*******************************************************************************/


// Message Map GLViewWindow class
FXDEFMAP(GLViewWindow) GLViewWindowMap[]={

  //__Message_Type_____________ID________________________Message_Handler_____
  FXMAPFUNC(SEL_COMMAND,     GLViewWindow::ID_ABOUT,      GLViewWindow::onCmdAbout),
  FXMAPFUNC(SEL_COMMAND,     GLViewWindow::ID_OPEN,       GLViewWindow::onCmdOpen),
  FXMAPFUNC(SEL_COMMAND,     GLViewWindow::ID_NEWVIEWER,  GLViewWindow::onCmdNewViewer),
  FXMAPFUNC(SEL_UPDATE,      GLViewWindow::ID_QUERY_MODE, GLViewWindow::onUpdMode),
  FXMAPFUNC(SEL_COMMAND,     FXWindow::ID_QUERY_MENU,	  GLViewWindow::onQueryMenu)
  };



// Macro for the GLViewWindow class hierarchy implementation
FXIMPLEMENT(GLViewWindow,FXMainWindow,GLViewWindowMap,ARRAYNUMBER(GLViewWindowMap))


/*******************************************************************************/

// Construct a GLViewWindow
GLViewWindow::GLViewWindow(FXApp* a):FXMainWindow(a,"OpenGL Test Application",NULL,NULL,DECOR_ALL,0,0,800,600){
  FXIcon *peng=new FXGIFIcon(getApp(),penguin);

  setIcon(peng);

  FXColorDialog *colordlg=new FXColorDialog(this,"Color Dialog",DECOR_TITLE|DECOR_BORDER);

  // Menubar
  menubar=new FXMenubar(this,LAYOUT_SIDE_TOP|LAYOUT_FILL_X);

  // Tool bar
  new FXHorizontalSeparator(this,LAYOUT_SIDE_TOP|SEPARATOR_GROOVE|LAYOUT_FILL_X);
  toolbar=new FXToolbar(this,LAYOUT_SIDE_TOP|LAYOUT_FILL_X,0,0,0,0, 4,4,4,4, 0,0);

  // Make status bar
  statusbar=new FXStatusbar(this,LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|STATUSBAR_WITH_DRAGCORNER);

  // The good old penguin, what would we be without it?
  new FXButton(statusbar,"\tHello, I'm Tux...\nThe symbol for the Linux Operating System.\nAnd all it stands for.",new FXGIFIcon(getApp(),penguin),NULL,0,LAYOUT_RIGHT);

  // Contents
  FXHorizontalFrame *frame=new FXHorizontalFrame(this,LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0, 0,0);

  // Nice sunken box around GL viewer
  FXVerticalFrame *box=new FXVerticalFrame(frame,FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0, 0,0,0,0);

  // MDI Client
  mdiclient=new FXMDIClient(box,LAYOUT_FILL_X|LAYOUT_FILL_Y);

  // MDI buttons in menu:- note the message ID's!!!!!
  // Normally, MDI commands are simply sensitized or desensitized;
  // Under the menubar, however, they're hidden if the MDI Client is
  // not maximized.  To do this, they must have different ID's.
  new FXMDIWindowButton(menubar,mdiclient,FXMDIClient::ID_MDI_MENUWINDOW,LAYOUT_LEFT);
  new FXMDIDeleteButton(menubar,mdiclient,FXMDIClient::ID_MDI_MENUCLOSE,FRAME_RAISED|LAYOUT_RIGHT);
  new FXMDIRestoreButton(menubar,mdiclient,FXMDIClient::ID_MDI_MENURESTORE,FRAME_RAISED|LAYOUT_RIGHT);
  new FXMDIMinimizeButton(menubar,mdiclient,FXMDIClient::ID_MDI_MENUMINIMIZE,FRAME_RAISED|LAYOUT_RIGHT);

  // Icon for MDI Child
  mdiicon=new FXGIFIcon(getApp(),winapp);

  // Make MDI Window Menu
  mdimenu=new FXMDIMenu(this,mdiclient);

  // Make an MDI Child
  FXMDIChild* mdichild=new FXMDIChild(mdiclient,"FOX GL Viewer",mdiicon,mdimenu,MDI_NORMAL,30,30,300,200);

  // A visual to drag OpenGL in double-buffered mode; note the glvisual is
  // shared between all windows which need the same depths and numbers of buffers
  // Thus, while the first visual may take some time to initialize, each subsequent
  // window can be created very quickly; we need to determine grpaphics hardware
  // characteristics only once.
  glvisual=new FXGLVisual(getApp(),VISUAL_DOUBLEBUFFER);

  // Make it active
  mdiclient->setActiveChild(mdichild);

  // Drawing gl canvas
  FXGLViewer *viewer=new FXGLViewer(mdichild,glvisual,this,ID_GLVIEWER,LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_LEFT);

  // Tab book with switchable panels
  FXTabBook* panels=new FXTabBook(frame);

  new FXTabItem(panels,"Angles\tCamera Angles\tSwitch to camera angles panel.");

  // Angles
  FXMatrix *angles=new FXMatrix(panels,3,FRAME_THICK|FRAME_RAISED|MATRIX_BY_COLUMNS|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_LEFT,0,0,0,0,10,10,10,10);
  new FXLabel(angles,"X:");
  new FXTextField(angles,6,mdiclient,FXGLViewer::ID_ROLL,TEXTFIELD_INTEGER|JUSTIFY_RIGHT|FRAME_SUNKEN|FRAME_THICK);
  FXDial* x_dial=new FXDial(angles,mdiclient,FXGLViewer::ID_DIAL_X,FRAME_SUNKEN|FRAME_THICK|DIAL_CYCLIC|DIAL_HORIZONTAL|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT|LAYOUT_CENTER_Y,0,0,160,14,0,0,0,0);
  x_dial->setTipText("Rotate about X");
  x_dial->setNotchOffset(900);

  new FXLabel(angles,"Y:");
  new FXTextField(angles,6,mdiclient,FXGLViewer::ID_PITCH,TEXTFIELD_INTEGER|JUSTIFY_RIGHT|FRAME_SUNKEN|FRAME_THICK);
  FXDial* y_dial=new FXDial(angles,mdiclient,FXGLViewer::ID_DIAL_Y,FRAME_SUNKEN|FRAME_THICK|DIAL_CYCLIC|DIAL_HORIZONTAL|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT|LAYOUT_CENTER_Y,0,0,160,14,0,0,0,0);
  y_dial->setTipText("Rotate about Y");
  y_dial->setNotchOffset(900);

  new FXLabel(angles,"Z:");
  new FXTextField(angles,6,mdiclient,FXGLViewer::ID_YAW,TEXTFIELD_INTEGER|JUSTIFY_RIGHT|FRAME_SUNKEN|FRAME_THICK);
  FXDial* z_dial=new FXDial(angles,mdiclient,FXGLViewer::ID_DIAL_Z,FRAME_SUNKEN|FRAME_THICK|DIAL_CYCLIC|DIAL_HORIZONTAL|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT|LAYOUT_CENTER_Y,0,0,160,14,0,0,0,0);
  z_dial->setTipText("Rotate about Z");
  z_dial->setNotchOffset(900);

  new FXLabel(angles,"FOV:");
  FXTextField* fov=new FXTextField(angles,5,mdiclient,FXGLViewer::ID_FOV,JUSTIFY_RIGHT|FRAME_SUNKEN|FRAME_THICK);
  new FXFrame(angles,0);
  fov->setTipText("Field of view");

  new FXLabel(angles,"Zoom:");
  FXTextField* zz=new FXTextField(angles,5,mdiclient,FXGLViewer::ID_ZOOM,JUSTIFY_RIGHT|FRAME_SUNKEN|FRAME_THICK);
  new FXFrame(angles,0);
  zz->setTipText("Zooming");

  new FXLabel(angles,"Scale X:");
  new FXTextField(angles,5,mdiclient,FXGLViewer::ID_SCALE_X,JUSTIFY_RIGHT|FRAME_SUNKEN|FRAME_THICK);
  new FXFrame(angles,0);
  new FXLabel(angles,"Scale Y:");
  new FXTextField(angles,5,mdiclient,FXGLViewer::ID_SCALE_Y,JUSTIFY_RIGHT|FRAME_SUNKEN|FRAME_THICK);
  new FXFrame(angles,0);
  new FXLabel(angles,"Scale Z:");
  new FXTextField(angles,5,mdiclient,FXGLViewer::ID_SCALE_Z,JUSTIFY_RIGHT|FRAME_SUNKEN|FRAME_THICK);
  new FXFrame(angles,0);

  // Colors
  new FXTabItem(panels,"Colors\tColors\tSwitch to color panel.");
  FXMatrix *colors=new FXMatrix(panels,2,MATRIX_BY_COLUMNS|FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_Y|LAYOUT_CENTER_X|LAYOUT_TOP|LAYOUT_LEFT,0,0,0,0,10,10,10,10);
  new FXLabel(colors,"Background:",NULL,LAYOUT_RIGHT|LAYOUT_CENTER_Y|JUSTIFY_RIGHT);
  new FXColorWell(colors,0,mdiclient,FXGLViewer::ID_BACK_COLOR,COLORWELL_OPAQUEONLY|LAYOUT_TOP|LAYOUT_LEFT, 0,0,0,0 ,0,0,0,0);
  new FXLabel(colors,"Ambient:",NULL,LAYOUT_RIGHT|LAYOUT_CENTER_Y|JUSTIFY_RIGHT);
  new FXColorWell(colors,0,mdiclient,FXGLViewer::ID_AMBIENT_COLOR,COLORWELL_OPAQUEONLY|LAYOUT_TOP|LAYOUT_LEFT, 0,0,0,0 ,0,0,0,0);


  new FXLabel(colors,"Light Amb:",NULL,LAYOUT_RIGHT|LAYOUT_CENTER_Y|JUSTIFY_RIGHT);
  new FXColorWell(colors,0,mdiclient,FXGLViewer::ID_LIGHT_AMBIENT,COLORWELL_OPAQUEONLY|LAYOUT_TOP|LAYOUT_LEFT, 0,0,0,0 ,0,0,0,0);
  new FXLabel(colors,"Light Diff:",NULL,LAYOUT_RIGHT|LAYOUT_CENTER_Y|JUSTIFY_RIGHT);
  new FXColorWell(colors,0,mdiclient,FXGLViewer::ID_LIGHT_DIFFUSE,COLORWELL_OPAQUEONLY|LAYOUT_TOP|LAYOUT_LEFT, 0,0,0,0 ,0,0,0,0);
  new FXLabel(colors,"Light Spec:",NULL,LAYOUT_RIGHT|LAYOUT_CENTER_Y|JUSTIFY_RIGHT);
  new FXColorWell(colors,0,mdiclient,FXGLViewer::ID_LIGHT_SPECULAR,COLORWELL_OPAQUEONLY|LAYOUT_TOP|LAYOUT_LEFT, 0,0,0,0 ,0,0,0,0);

  // Switches
  new FXTabItem(panels,"Settings\tSettings\tSwitche to settings panel.");
  FXVerticalFrame *settings=new FXVerticalFrame(panels,FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_Y|LAYOUT_CENTER_X|LAYOUT_TOP|LAYOUT_LEFT,0,0,0,0,10,10,10,10);
  new FXCheckButton(settings,"Lighting",mdiclient,FXGLViewer::ID_LIGHTING,ICON_BEFORE_TEXT);
  new FXCheckButton(settings,"Fog",mdiclient,FXGLViewer::ID_FOG,ICON_BEFORE_TEXT);
  new FXCheckButton(settings,"Dither",mdiclient,FXGLViewer::ID_DITHER,ICON_BEFORE_TEXT);
  new FXCheckButton(settings,"Lock",mdiclient,FXGLViewer::ID_LOCK,ICON_BEFORE_TEXT);
  new FXCheckButton(settings,"Turbo",mdiclient,FXGLViewer::ID_TURBO,ICON_BEFORE_TEXT);


  FXIcon *newdoc=new FXGIFIcon(getApp(),filenew);
  FXIcon *opendoc=new FXGIFIcon(getApp(),fileopen);
  FXIcon *savedoc=new FXGIFIcon(getApp(),filesave);
  FXIcon *saveasdoc=new FXGIFIcon(getApp(),filesaveas,0,IMAGE_ALPHAGUESS);

  // File Menu
  filemenu=new FXMenuPane(this);
  new FXMenuTitle(menubar,"&File",NULL,filemenu);
  new FXMenuCommand(filemenu,"&New...\tCtl-N\tCreate new document.",newdoc);
  new FXMenuCommand(filemenu,"&Open...\tCtl-O\tOpen document file.",opendoc,this,ID_OPEN);
  new FXMenuCommand(filemenu,"&Save\tCtl-S\tSave document.",savedoc);
  new FXMenuCommand(filemenu,"Save &As...\t\tSave document to another file.",saveasdoc);
  new FXMenuCommand(filemenu,"&Print Image...\t\tPrint snapshot image.",NULL,mdiclient,FXGLViewer::ID_PRINT_IMAGE,MENU_AUTOGRAY);
  new FXMenuCommand(filemenu,"&Print Vector...\t\tPrint geometry.",NULL,mdiclient,FXGLViewer::ID_PRINT_VECTOR,MENU_AUTOGRAY);
  new FXMenuCommand(filemenu,"&Dump...\t\tDump widgets.",NULL,getApp(),FXApp::ID_DUMP);
  new FXMenuCommand(filemenu,"&Quit\tCtl-Q\tQuit the application.",NULL,getApp(),FXApp::ID_QUIT);

  // Edit Menu
  editmenu=new FXMenuPane(this);
  new FXMenuTitle(menubar,"&Edit",NULL,editmenu);
  new FXMenuCommand(editmenu,"Copy\tCtl-C",NULL,mdiclient,FXGLViewer::ID_COPY_SEL,MENU_AUTOGRAY);
  new FXMenuCommand(editmenu,"Cut\tCtl-X",NULL,mdiclient,FXGLViewer::ID_CUT_SEL,MENU_AUTOGRAY);
  new FXMenuCommand(editmenu,"Paste\tCtl-V",NULL,mdiclient,FXGLViewer::ID_PASTE_SEL,MENU_AUTOGRAY);
  new FXMenuCommand(editmenu,"Delete",NULL,mdiclient,FXGLViewer::ID_DELETE_SEL,MENU_AUTOGRAY);

  // File manipulation
  new FXButton(toolbar,"\tNew\tCreate new document.",newdoc,NULL,0,FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,"\tOpen\tOpen document file.",opendoc,this,ID_OPEN,FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,"\tSave\tSave document.",savedoc,NULL,0,FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,"\tSave As\tSave document to another file.",saveasdoc,this,ID_OPEN,FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,"\tNew Folder\tNo comment",new FXGIFIcon(getApp(),newfolder),NULL,0,FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);

  // Print
  new FXFrame(toolbar,LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,0,0,4,20);
  new FXButton(toolbar,"\tPrint Image\tPrint shapshot image.",new FXGIFIcon(getApp(),print),mdiclient,FXGLViewer::ID_PRINT_IMAGE,BUTTON_AUTOGRAY|FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);

  // Editing
  new FXFrame(toolbar,LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,0,0,4,20);
  new FXButton(toolbar,"\tCut",new FXGIFIcon(getApp(),cut),mdiclient,FXGLViewer::ID_CUT_SEL,BUTTON_AUTOGRAY|FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,"\tCopy",new FXGIFIcon(getApp(),copy),mdiclient,FXGLViewer::ID_COPY_SEL,BUTTON_AUTOGRAY|FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,"\tPaste",new FXGIFIcon(getApp(),paste),mdiclient,FXGLViewer::ID_PASTE_SEL,BUTTON_AUTOGRAY|FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);

  // Projections
  new FXFrame(toolbar,LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,0,0,8,20);
  new FXButton(toolbar,"\tPerspective\tSwitch to perspective projection.",new FXGIFIcon(getApp(),perspective),mdiclient,FXGLViewer::ID_PERSPECTIVE,BUTTON_AUTOGRAY|FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,"\tParallel\tSwitch to parallel projection.",new FXGIFIcon(getApp(),parallel),mdiclient,FXGLViewer::ID_PARALLEL,BUTTON_AUTOGRAY|FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);

  // Shading model
  new FXFrame(toolbar,LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,0,0,8,20);
  new FXButton(toolbar,"\tNo shading\tTurn light sources off.",new FXGIFIcon(getApp(),nolight),mdiclient,FXGLShape::ID_SHADEOFF,BUTTON_AUTOGRAY|FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,"\tFlat shading\tTurn on faceted (flat) shading.",new FXGIFIcon(getApp(),light),mdiclient,FXGLShape::ID_SHADEON,BUTTON_AUTOGRAY|FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,"\tSmooth shading\tTurn on smooth shading.",new FXGIFIcon(getApp(),smoothlight),mdiclient,FXGLShape::ID_SHADESMOOTH,BUTTON_AUTOGRAY|FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);

  new FXFrame(toolbar,LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,0,0,8,20);
  new FXToggleButton(toolbar,"\tToggle Light\tToggle light source.",NULL,new FXGIFIcon(getApp(),nolight),new FXGIFIcon(getApp(),light),NULL,0,FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);

  // View orientation
  new FXFrame(toolbar,LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,0,0,8,20);
  new FXButton(toolbar,"\tFront View\tView objects from the front.",new FXGIFIcon(getApp(),frontview),mdiclient,FXGLViewer::ID_FRONT,BUTTON_AUTOGRAY|FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,"\tBack View\tView objects from behind.",new FXGIFIcon(getApp(),backview),mdiclient,FXGLViewer::ID_BACK,BUTTON_AUTOGRAY|FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,"\tLeft View\tView objects from the left.",new FXGIFIcon(getApp(),leftview),mdiclient,FXGLViewer::ID_LEFT,BUTTON_AUTOGRAY|FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,"\tRight View\tView objects from the right.",new FXGIFIcon(getApp(),rightview),mdiclient,FXGLViewer::ID_RIGHT,BUTTON_AUTOGRAY|FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,"\tTop View\tView objects from the top.",new FXGIFIcon(getApp(),topview,0,IMAGE_OPAQUE),mdiclient,FXGLViewer::ID_TOP,BUTTON_AUTOGRAY|FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,"\tBottom View\tView objects from below.",new FXGIFIcon(getApp(),bottomview,0,IMAGE_OPAQUE),mdiclient,FXGLViewer::ID_BOTTOM,BUTTON_AUTOGRAY|FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);

  // Miscellaneous buttons
  new FXFrame(toolbar,LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,0,0,8,20);
  new FXButton(toolbar,(FXchar*)0,new FXGIFIcon(getApp(),zoom),NULL,0,FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,"\tColors\tDisplay color dialog.",new FXGIFIcon(getApp(),colorpal),colordlg,FXWindow::ID_SHOW,FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,(FXchar*)0,new FXGIFIcon(getApp(),camera,0,IMAGE_OPAQUE),NULL,0,FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  new FXButton(toolbar,(FXchar*)0,new FXGIFIcon(getApp(),foxicon),NULL,0,FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);

  // Dangerous delete a bit on the side
  new FXFrame(toolbar,LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,0,0,10,20);
  new FXButton(toolbar,"\tDelete\tDelete the selected object.",new FXGIFIcon(getApp(),killobject),mdiclient,FXGLViewer::ID_DELETE_SEL,BUTTON_AUTOGRAY|FRAME_THICK|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);

  // View menu
  viewmenu=new FXMenuPane(this);
  new FXMenuTitle(menubar,"&View",NULL,viewmenu);
  new FXMenuCommand(viewmenu,"Parallel\t\tSwitch to parallel projection.",NULL,mdiclient,FXGLViewer::ID_PARALLEL,MENU_AUTOGRAY);
  new FXMenuCommand(viewmenu,"Perspective\t\tSwitch to perspective projection.",NULL,mdiclient,FXGLViewer::ID_PERSPECTIVE,MENU_AUTOGRAY);
  new FXMenuCommand(viewmenu,"&Front\tCtl-F\tFront view.",NULL,mdiclient,FXGLViewer::ID_FRONT,MENU_AUTOGRAY);
  new FXMenuCommand(viewmenu,"&Back\tCtl-B\tBack view.",NULL,mdiclient,FXGLViewer::ID_BACK,MENU_AUTOGRAY);
  new FXMenuCommand(viewmenu,"&Left\tCtl-L\tLeft view.",NULL,mdiclient,FXGLViewer::ID_LEFT,MENU_AUTOGRAY);
  new FXMenuCommand(viewmenu,"&Right\tCtl-R\tRight view.",NULL,mdiclient,FXGLViewer::ID_RIGHT,MENU_AUTOGRAY);
  new FXMenuCommand(viewmenu,"&Top\tCtl-T\tTop view.",NULL,mdiclient,FXGLViewer::ID_TOP,MENU_AUTOGRAY);
  new FXMenuCommand(viewmenu,"&Bottom\tCtl-K\tBottom view.",NULL,mdiclient,FXGLViewer::ID_BOTTOM,MENU_AUTOGRAY);
  new FXMenuCommand(viewmenu,"F&it\t\tFit to view.",NULL,mdiclient,FXGLViewer::ID_FITVIEW,MENU_AUTOGRAY);
  new FXMenuCommand(viewmenu,"R&eset\tCtl-G\tReset all viewing parameters",NULL,mdiclient,FXGLViewer::ID_RESETVIEW,MENU_AUTOGRAY);
  new FXMenuCommand(viewmenu,"Zoom\t\tZoom in on area",NULL,mdiclient,FXGLViewer::ID_LASSO_ZOOM,MENU_AUTOGRAY);
  new FXMenuCommand(viewmenu,"Select\t\tZoom in on area",NULL,mdiclient,FXGLViewer::ID_LASSO_SELECT,MENU_AUTOGRAY);
  new FXMenuCommand(viewmenu,"Lock\t\tLock view orientation",NULL,mdiclient,FXGLViewer::ID_LOCK,MENU_AUTOGRAY);

  // Rendering menu
  rendermenu=new FXMenuPane(this);
  new FXMenuTitle(menubar,"&Rendering",NULL,rendermenu);
  new FXMenuCommand(rendermenu,"Points\t\tRender as points.",NULL,mdiclient,FXGLShape::ID_STYLE_POINTS,MENU_AUTOGRAY);
  new FXMenuCommand(rendermenu,"Wire Frame\t\tRender as wire frame.",NULL,mdiclient,FXGLShape::ID_STYLE_WIREFRAME,MENU_AUTOGRAY);
  new FXMenuCommand(rendermenu,"Surface \t\tRender solid surface.",NULL,mdiclient,FXGLShape::ID_STYLE_SURFACE,MENU_AUTOGRAY);
  new FXMenuCommand(rendermenu,"Bounding Box\t\tRender bounding box only.",NULL,mdiclient,FXGLShape::ID_STYLE_BOUNDINGBOX,MENU_AUTOGRAY);

  // Window menu
  windowmenu=new FXMenuPane(this);
  new FXMenuTitle(menubar,"&Windows",NULL,windowmenu);
  new FXMenuCommand(windowmenu,"New Viewer\t\tCreate new viewer window.",NULL,this,ID_NEWVIEWER);
  new FXMenuCommand(windowmenu,"Tile Horizontally\t\tTile windows horizontally.",NULL,mdiclient,FXMDIClient::ID_MDI_TILEHORIZONTAL);
  new FXMenuCommand(windowmenu,"Tile Vertically\t\tTile windows vertically.",NULL,mdiclient,FXMDIClient::ID_MDI_TILEVERTICAL);
  new FXMenuCommand(windowmenu,"Cascade\t\tCascade windows.",NULL,mdiclient,FXMDIClient::ID_MDI_CASCADE);
  new FXMenuCommand(windowmenu,"Toolbar",NULL,toolbar,FXWindow::ID_TOGGLESHOWN);
  new FXMenuCommand(windowmenu,"Control panel",NULL,panels,FXWindow::ID_TOGGLESHOWN);
  new FXMenuCommand(windowmenu,"Delete\t\tDelete current viewer window.",NULL,mdiclient,FXMDIClient::ID_MDI_CLOSE);
  FXMenuSeparator* sep1=new FXMenuSeparator(windowmenu);
  sep1->setTarget(mdiclient);
  sep1->setSelector(FXMDIClient::ID_MDI_ANY);
  new FXMenuCommand(windowmenu,NULL,NULL,mdiclient,FXMDIClient::ID_MDI_1);
  new FXMenuCommand(windowmenu,NULL,NULL,mdiclient,FXMDIClient::ID_MDI_2);
  new FXMenuCommand(windowmenu,NULL,NULL,mdiclient,FXMDIClient::ID_MDI_3);
  new FXMenuCommand(windowmenu,NULL,NULL,mdiclient,FXMDIClient::ID_MDI_4);

  // Help menu
  helpmenu=new FXMenuPane(this);
  new FXMenuTitle(menubar,"&Help",NULL,helpmenu,LAYOUT_RIGHT);
  new FXMenuCommand(helpmenu,"&About FOX...\t\tDisplay FOX about panel.",NULL,this,ID_ABOUT,0);

  // Make a tool tip
  new FXTooltip(getApp(),0);

  // The status bar shows our mode
  statusbar->getStatusline()->setTarget(this);
  statusbar->getStatusline()->setSelector(ID_QUERY_MODE);

  // Make a scene!
  scene=new FXGLGroup;
//   scene->append(new FXGLPoint(2,0,0));
//   scene->append(new FXGLPoint(0,2,0));
//   scene->append(new FXGLPoint(2,2,0));
//   scene->append(new FXGLPoint(0,0,0));
//   scene->append(new FXGLLine(0,0,0, 1,0,0));
//   scene->append(new FXGLLine(0,0,0, 0,1,0));
//   scene->append(new FXGLLine(0,0,0, 0,0,1));
//   scene->append(new FXGLLine(0,0,0, 1,1,1));
  FXGLGroup *gp2=new FXGLGroup;
  scene->append(gp2);
  FXGLSphere *sphere=new FXGLSphere(1.0, 1.0, 0.0, 0.5);
  FXGLSphere *sphere2=new FXGLSphere(0.0, 0.0, 0.0, 0.8);
  sphere->setTipText("Sphere");
  gp2->append(new FXGLCube(-1.0, 0.0, 0.0,  1.0, 1.0, 1.0));
  gp2->append(new FXGLCube( 1.0, 0.0, 0.0,  1.0, 1.0, 1.0));
  gp2->append(new FXGLCube( 0.0,-1.0, 0.0,  1.0, 1.0, 1.0));
  gp2->append(new FXGLCube( 0.0, 1.0, 0.0,  1.0, 1.0, 1.0));
  gp2->append(new FXGLCone(1.0,-1.5, 0.0, 1.0, 0.5));
  gp2->append(new FXGLCylinder(-1.0, 0.5, 0.0, 1.0, 0.5));
  gp2->append(sphere);
  gp2->append(sphere2);

  // Add scene to GL viewer
  viewer->setScene(scene);

  }


// Destructor
GLViewWindow::~GLViewWindow(){
  delete filemenu;
  delete editmenu;
  delete viewmenu;
  delete rendermenu;
  delete windowmenu;
  delete helpmenu;
  }



// Create and initialize
void GLViewWindow::create(){
  FXMainWindow::create();
  show(PLACEMENT_SCREEN);
  }


// About
long GLViewWindow::onCmdAbout(FXObject*,FXSelector,void*){
  FXMessageBox::information(this,MBOX_OK,"About FOX","FOX OpenGL Example.\nCopyright (C) 1998 Jeroen van der Zijp");
  return 1;
  }


// Open
long GLViewWindow::onCmdOpen(FXObject*,FXSelector,void*){
  const FXchar *patterns[]={
    "All Files",          "*",
    "C++ Source Files",   "*.[Cc][Pp][Pp]",
    "C++ Header Files",   "*.[Hh]",
    "Object Files",       "*.o",
    "HTML Header Files",  "*.[Hh][Tt][Mm][Ll]",NULL};
  FXFileDialog open(this,"Open some file");
  open.setPatternList(patterns);
  if(open.execute()){
    fxmessage("File=%s\n",open.getFilename().text());
    }
  return 1;
  }



// Make new viewer
long GLViewWindow::onCmdNewViewer(FXObject*,FXSelector,void*){
  static int no=1;

  // Make new MDI child widget
  FXMDIChild* mdichild=new FXMDIChild(mdiclient,FXStringFormat("GL Viewer #%d",no),mdiicon,mdimenu,MDI_NORMAL,30,30,300,200);

  FXGLViewer *view=new FXGLViewer(mdichild,glvisual,this,ID_GLVIEWER);

  // Change of scenery
  view->setScene(scene);

  // Create the new window
  mdichild->create();

  // Next number
  no++;
  return 1;
  }


// Statusbar wanted to know about mode
// We fake it here for the purpose of demonstration...
long GLViewWindow::onUpdMode(FXObject* sender,FXSelector,void*){
  FXStatusline *statusline=(FXStatusline*)sender;
  statusline->setText("Ready.");
  return 1;
  }


/*
*  When the user right-clicks in the GLViewer background, the viewer first sends
*  a SEL_COMMAND message with identifier FXWindow::ID_QUERY_MENU to the selected
*  GLObject (if any). If that message isn't handled, it tries to send it to the
*  GLViewer's target (which in our case is the main window).
*/
long GLViewWindow::onQueryMenu(FXObject* sender,FXSelector,void* ptr){
  FXEvent *event=(FXEvent*)ptr;
  FXMenuPane pane(this);
  new FXMenuCommand(&pane,"Parallel\t\tSwitch to parallel projection.",NULL,sender,FXGLViewer::ID_PARALLEL);
  new FXMenuCommand(&pane,"Perspective\t\tSwitch to perspective projection.",NULL,sender,FXGLViewer::ID_PERSPECTIVE);
  new FXMenuSeparator(&pane);
  new FXMenuCommand(&pane,"&Front\t\tFront view.",NULL,sender,FXGLViewer::ID_FRONT);
  new FXMenuCommand(&pane,"&Back\t\tBack view.",NULL,sender,FXGLViewer::ID_BACK);
  new FXMenuCommand(&pane,"&Left\t\tLeft view.",NULL,sender,FXGLViewer::ID_LEFT);
  new FXMenuCommand(&pane,"&Right\t\tRight view.",NULL,sender,FXGLViewer::ID_RIGHT);
  new FXMenuCommand(&pane,"&Top\t\tTop view.",NULL,sender,FXGLViewer::ID_TOP);
  new FXMenuCommand(&pane,"&Bottom\t\tBottom view.",NULL,sender,FXGLViewer::ID_BOTTOM);
  new FXMenuSeparator(&pane);
  new FXMenuCommand(&pane,"F&it\t\tFit to view.",NULL,sender,FXGLViewer::ID_FITVIEW);
  new FXMenuCommand(&pane,"R&eset\t\tReset all viewing parameters",NULL,sender,FXGLViewer::ID_RESETVIEW);
  new FXMenuCommand(&pane,"Lock\t\tLock view orientation",NULL,sender,FXGLViewer::ID_LOCK);
  pane.create();
  pane.popup(NULL,event->root_x,event->root_y);
  getApp()->runModalWhileShown(&pane);
  return 1;
  }


// Here we begin
int main(int argc,char *argv[]){

  // Make application
  FXApp application("GLViewer","FoxTest");

  // Open the display
  application.init(argc,argv);

  // Make window
  new GLViewWindow(&application);

  // Create the application's windows
  application.create();

  // Run the application
  return application.run();
  }



#else


// Here we begin
int main(int argc,char *argv[]){
  fxmessage("The FOX Library was compiled without OpenGL\n");
  return 0;
  }


#endif