aboutsummaryrefslogtreecommitdiffstats
path: root/gl4java/GLContext.java.skel
blob: c91e4f6124fdecf92be7d25f6dddf650503f9eaf (plain)
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
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
/**
 * @(#) GLContext.java
 */


package gl4java;

import gl4java.jau.awt.WinHandleAccess;

import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;
import java.lang.reflect.*;

/**
 * The base manager class for the OpenGL language mapping for Java !
 *
 * <p>
 * If you are interessting in further Documentation and/or
 * the history of GL4Java follow the following link.
 * 
 * <pre>
        <a href="../GL4Java.html">The GL4Java Documentation</a>
 * </pre>
 * <p>
 *
 * All native libraries and GLFunc* and GLUFunc* implementations
 * can/should be loaded right here !
 *
 * <pre>
 	<a href="GLContext.html#loadNativeLibraries(java.lang.String, java.lang.String, java.lang.String)">loadNativeLibraries</a>
 	<a href="GLContext.html#createGLFunc(java.lang.String)">createGLFunc</a>
 	<a href="GLContext.html#createGLUFunc(java.lang.String)">createGLUFunc</a>
        <p>
        To check the library versions, you can start the 
 	<a href="GLContext.html#main(java.lang.String[])">main</a>
        function with <code>java gl4java.GLContext</code>
 * </pre>
 *
 * <p>
 *
 * This class creates a GLContext in the constructor which fits to the native Window 
 * of the given Component !
 *
 * <pre>
   	<a href="GLContext.html#GLContext(java.awt.Component, gl4java.GLFunc, gl4java.GLUFunc>
 * </pre>
 *
 * <p>
 *
 * If you want to port any OpenGL program to GL4Java,
 * you can use 'glc2glj'. This easy kornshell-sed script converts
 * many types and Math function calls ;-). E.g.: All C double constant literals
 * will be changed to floats (0.0 -> 0.0f) and all sin, cos, .. functions
 * will get the '(float)Math.' prefix !
 *
 * <pre>
	<a href="../../../demos/glc2glj">glc2glj - A simple c to java converter for C- and GL-types</a>
 * </pre>
 * <p>
 *
 * The native libraries are plattform depended. 
 *
 * <pre>
	  The default native library for Win32 and Unice's is :
	  <p>
	  	GLContext:	GL4JavaJauGljJNI
		GLFuncJauJNI:	GL4JavaJauGLJNI
		GLUFuncJauJNI:	GL4JavaJauGLUJNI
	  <p>
		Note:
	  <p>
	  The default native library for Macintosh is :
	  <p>
	  	GLContext:	GL4JavaMacGZGljJNI
		GLFuncJauJNI:	GL4JavaMacGZGLJNI
		GLUFuncJauJNI:	GL4JavaMacGZGLUJNI
	  <p>
	  <p>
	  To check wich version and vendors are currently used,
	  just call while a GLContext is created :
	  <p>
	  <a href="GLContext.html#gljShowVersions()">gljShowVersions</a>
	  <p>
	  Where an own Frame is opened !
 * </pre>
 *
 * Make sure that this library is installed in your library path.
 * The library path is for Unices one path of the environment 
 * variable �LD_LIBRARY_PATH� and for Windows 32 
 * �c:/winnt/system32� (WinNT) or 'c:/windows/system' (Windows 95) .
 * Or it should be installed in the 'jre/bin' or 
 * 'Netscape/communicator/Program/java/bin'  path !
 *
 * <p>
 *
 * To have a convinient usage, e.g. automatic resizing, GLContext
 * and painting/gl-rendering, some classes in the package gl4java.awt
 * may help you.
 * 
 * <pre>
          E.g.: <a href="awt/GLCanvas.html">gl4java.awt.GLCanvas</a> 
	  <p>
	  <a href="awt/GLCanvas.html#init()">init</a> to create the java-stuff and GL-inits 
	  <a href="awt/GLCanvas.html#display()">display</a> to render one frame, called by paint
	  <a href="awt/GLCanvas.html#reshape(int, int)">reshape</a> to reshape (window resize)
          <p>
          Or look for animation at 
	  <a href="awt/GLAnimCanvas.html">gl4java.awt.GLAnimCanvas</a> !
 * </pre>
 *
 * <p>
 *
 * IF you remove/release a The component which is binded to this GLContext,
 * you have to release the GLContext also - while calling:
 *
 * <pre>
 	<a href="GLContext.html#gljDestroy()">gljDestroy</a>
 * </pre>
 *
 * before releasing/dispose it�s Window !
 * 
 * <p>
 *
 * We also define our own OpenGL extension. This extension functions
 * start with the prefix glj like you can see here:
 *
 * <pre>
        THIS FUNCTIONS ARE FOR USERS PURPOSES:
	======================================

 	<a href="GLContext.html#loadNativeLibraries(java.lang.String, java.lang.String, java.lang.String)">loadNativeLibraries</a>
 	<a href="GLContext.html#createGLFunc(java.lang.String)">createGLFunc</a>
 	<a href="GLContext.html#createGLUFunc(java.lang.String)">createGLUFunc</a>
 	<a href="GLContext.html#gljGetNativeLibVersion()">gljGetNativeLibVersion</a>
 	<a href="GLContext.html#gljGetClassVersion()">gljGetClassVersion</a>
	<a href="GLContext.html#gljShowVersions()">gljShowVersions</a>
 	<a href="GLContext.html#gljCheckGL()">gljCheckGL</a>
 	<a href="GLContext.html#gljCheckGLTypes()">gljCheckGLTypes</a>
 	<a href="GLContext.html#gljResize(int, int)">gljResize</a>
 	<a href="GLContext.html#gljSwap()">gljSwap</a>
 	<a href="GLContext.html#gljIsInit()">gljIsInit</a>
 	<a href="GLContext.html#gljMakeCurrent(boolean)">gljMakeCurrent</a>
 	<a href="GLContext.html#gljDestroy()">gljDestroy</a>
 	<a href="GLContext.html#gljFree()">gljFree</a>

 * </pre>
 * <p>
 *
 * You can see our example demo sources:
 * <pre>
	<a href="../../../demos/olympicCvs.java">olympicCvs.java as java source</a>
	<a href="../../../demos/glLogoCvs.java">glLogoCvs.java as java source</a>
	<a href="../../../demos/glDemosCvs.java">glDemosCvs.java as java source</a>
 * </pre>
 * <p>
 *
 * If you are interessting in further Documentation, downloading the latest
 * version,  and/or the history of GL4Java click on the following link.
 * 
 * <pre>
	<a href="http://www.jausoft.com/gl4java.html">The GL4Java Homepage</a>
 * </pre>
 * <p>
 *
 * @see WinDataAccess
 * @version 	2.00, 21. April 1999
 * @author      Sven Goethel
 * 
 */
public class GLContext extends Object 
	implements Runnable
{

    protected boolean isInitialized = false;

   /**
    * Flag is the native library is loaded.
    * The native library is loaded at startup.
    * If we failed loading the lib., 
    * gljMakeCurrent and gljIsInit will return false.
    *
    * @see GLContext#gljMakeCurrent
    * @see GLContext#gljIsInit
    */
    protected static boolean libsLoaded 	        = false;

    /**
     * The default GLContext native library for Windows 95/NT && MS-JVM
     *
     */
    public static final String defGljMSWinLib   = "GL4JavaGljMSJDirect" ;

    /**
     * The default GLContext native library for all 
     *
     */
    public static final String defGljLib   = "GL4JavaJauGljJNI" ;

    /**
     * The default GLFunc implementation 
     *
     */
    public static final String defGLFuncClass 	   = "GLFuncJauJNI" ;

    /**
     * The default GLFunc native library for all
     */
    public static final String defGLFuncLib = "GL4JavaJauGLJNI" ;

    /**
     * The default GLUFunc implementation 
     *
     */
    public static final String defGLUFuncClass = "GLUFuncJauJNI" ;

    /**
     * The default GLUFunc native library for all
     */
    public static final String defGLUFuncLib = "GL4JavaJauGLUJNI" ;


   /**
    * the version of this java-class
    *
    * <Major>.<Minor>.<BugFix>.<Release>
    *
    * Each <Value> is dezimal !
    */
    public static final String version             = __SED_CLASS_VERSION__ ;

   /**
    * Flag's to enable/disable verbose Information.
    * Usually for debugging.
    */
    public static boolean gljClassDebug 	= false;
    public static boolean gljNativeDebug 	= false;
    
   /**
    * We will store the GL Context right here.
    *
    * @see GLContext#createGLContext
    * @see GLContext#gljInit
    */
    protected int glContext=0;	

   /**
    * The context with witch display lists and textures will be shared.
    *
    * @see GLContext#createGLContext
    * @see GLContext#gljInit
    */
    protected GLContext sharedGLContext;	
    protected int sharedGLContextNative= 0; // No sharing by default.	

   /**
    * Xwindow data AND Windows data for the widget
    *
    * @see GLContext#createGLContext
    * @see GLContext#gljInit
    */
    protected int pixmapHandle=0;     // unique handle for the Pixmap
    protected int windowHandle=0;     // unique handle for this widget's window
    protected int displayHandle=0;    // unqiue handle to the display

   /**
    * MS-JDirect-Window data for the MS-JVM interface
    *
    * @see GLContext#createGLContext
    * @see GLContext#gljInit
    */
    private int createwinx;
    private int createwiny;
    private int createwinw;
    private int createwinh;
    private boolean threadRunning = false;
    private boolean destroyWindow = false;
    protected Container containerWindow = null;

   /**
    * The custom set offscreen Size
    *
    * If this is set to != null, 
    * the offscreen pixmap is used in this size,
    * not in the components-size (-> faster if smaller)
    *
    * Must be set via createOffScreenCtx
    *
    * @see GLJPanel#paint
    * @see GLJPanel#createOffScreenCtx
    */
    protected Dimension offScrnSize = null;

   /**
    * Windows data AND flag is Window-Handel is read (for X11 also) ! 
    *
    * @see GLContext#createGLContext
    * @see GLContext#gljInit
    */
    int pData = 0;  // stores the pointer structure that holds windows info

    /**
     * Flag to check, if the OpenGL-Context is active !
     *
     * @see	GLCanvas#gljIsEnabled
     * @see	GLCanvas#gljSetEnabled
     */
    protected boolean glEnabled = true;

   /**
    * Do we use offscreen rendering 
    *  X11: pixmap eq window-ressources, 
    *       window eq. GLXPixmap a GLXDrawable
    *       glContext eq. GLXContext
    *
    * This is set via the constructor !
    * 
    * @see GLContext#GLContext
    */
    protected boolean offScreenRenderer = false;    

   /**
    * Do we use doubleBuffer - of course !
    * This is the default visual property ... !
    *
    * This is set via the constructor !
    * 
    * @see GLContext#isDoubleBuffer
    * @see GLContext#GLContext
    */
    protected boolean doubleBuffer = true;    

    /**
     * Visual pre-set for stencil-bit number, default: 0
     *
     * @see GLContext#GLContext
     */
    protected int stencilBits = 0;

    /**
     * Visual pre-set for accumulator-size number, default: 0
     *
     * This value has a special behavior.
     * For input - within the contructor,
     * it is the value for each component !
     *
     * The output value, after the constructor returns,
     * it is the summary of all accumulation bits of all components !
     *
     * @see GLContext#GLContext
     */
    protected int accumSize = 0;

   /**
    * Do we use stereoView - not yet ;-) !
    * This is the default visual property ... !
    *
    * This is set via the constructor !
    * 
    * @see GLContext#isStereoView
    * @see GLContext#GLContext
    */
    protected boolean stereoView = false;    

   /**
    * Do we use True-Color RGBA  - of course ;-) !
    * This is the default visual property ... !
    *
    * This is set via the constructor !
    * 
    * @see GLContext#isRGBA
    * @see GLContext#GLContext
    */
    protected boolean rgba = true;    

   /**
    * We normally do not have to create an own Window !
    * This is the default visual property ... !
    * But some machines, like SGI's Irix, 
    * must use an own created overlapped window !
    * For these machines, a compiler flag is set, 
    * so that this value is alsways set to true !
    *
    * This is set via the constructor !
    * 
    * @see GLContext#isOwnWindowCreated
    * @see GLContext#GLContext
    */
    protected boolean createOwnWindow = false;

   /**
    * The resize flag, which indicates a resize for the next paint function !
    * This flag will bes set in 'componentResized'
    * and will be cleared after resize (glViewport) in sDisplay !!
    *
    * @see gl4java.awt.GLCanvas#sDisplay
    */
    protected boolean mustResize = false;

    protected Dimension size = null;

    /**
     * the light- or heavy component
     * where GL commands should be drawn
     */
    protected Component _comp = null;

    /**
     * the heavy component
     * where GL commands should be drawn
     *
     * if the _comp component is a swing (light)
     * component, this component contains its heavy parent !
     */
    protected Component _compHeavy = null;

   /**
    * Variable to tell is where windows or not (X11) 
    * Usally X11 ;-))
    *
    * Ok - lets give one to the Max :-) 
    */
    public static final int
       OsWindoof	= -1,
       OsUnknown	=  0,
       OsX11	   	=  1,
       OsMac		=  2; // for Gerard Ziemski's port
 
    private static int osType=OsUnknown;
  
    private static boolean isNetscapeJvm = false;
    private static boolean isMicrosoftJvm = false;
    private static boolean useMSJDirect = false;
    private static String jvmVendor = null;
    private static String jvmVersion = null;
    private static int    jvmVersionMajor = 1; // min. defaults
    private static int    jvmVersionMinor = 1; // min. defaults
    private static String osName = null;

   /**
    * Get the native GL Context !
    *
    * @see GLContext#glContext
    */
    public final long getNativeGLContext() { return (long)glContext; }

   /**
    * Get the native Window Handle !
    *
    * @see GLContext#windowHandle
    */
    public final long getNativeWindoHandle() { return (long)windowHandle; }

   /**
    * Get the optional shared GL Context !
    *
    * @see GLContext#sharedGLContext
    */
    public final GLContext getSharedGLContext() { return sharedGLContext; }

   /**
    * Get the native OS-Type !
    *
    * @see GLContext#osType
    * @see GLContext#OsWindoof
    * @see GLContext#OsUnknown
    * @see GLContext#OsX11
    * @see GLContext#OsMac
    */
    public final int getNativeOSType() { return osType; }

   /**
    * Query the visual property ... !
    *
    * After a GLContext is created, this property can be queried !
    *
    * @see GLContext#doubleBuffer
    * @see GLContext#GLContext
    */
    public final boolean isDoubleBuffer() { return doubleBuffer; }

   /**
    * Query the visual property ... !
    *
    * After a GLContext is created, this property can be queried !
    *
    * @see GLContext#stereoView
    * @see GLContext#GLContext
    */
    public final int getStencilBitNumber() { return stencilBits; }

   /**
    * Query the visual property ... !
    *
    * After a GLContext is created, this property can be queried !
    *
    * @see GLContext#GLContext
    */
    public final int getAccumSize() { return accumSize; }

   /**
    * Query the visual property ... !
    *
    * After a GLContext is created, this property can be queried !
    *
    * @see GLContext#stereoView
    * @see GLContext#GLContext
    */
    public final boolean isStereoView() { return stereoView; }

   /**
    * Query the visual property ... !
    *
    * After a GLContext is created, this property can be queried !
    *
    * @see GLContext#rgba
    * @see GLContext#GLContext
    */
    public final boolean isRGBA() { return rgba; }

   /**
    * Query the visual property ... !
    *
    * After a GLContext is created, this property can be queried !
    *
    * @see GLContext#createOwnWindow
    * @see GLContext#GLContext
    */
    public final boolean isOwnWindowCreated() { return createOwnWindow; }

    /**
     * Support of loading the native library seperatly.
     *
     * Link with the native OpenGL library.  If we cannot link, an exception
     * is thrown.  
     * The name of the library is named e.g.: "GL4JavaJauGljJNI" at the 
     * Java level, or "libGL4JavaJauGljJNI.so" at the solaris level,
     * or "GL4JavaJauGljJNI.dll" at the win32 level :-).
     *
     * @param gljLibName The name of the GLContex native library.
     *                   If gljLibName==null, the default library will be used !
     *
     * @param glLibName  The name of the GLFunc native library.
     *                   If glLibName==null, the default library will be used !
     *
     * @param gluLibName The name of the GLUFunc native library.
     *                   If gluLibName==null, the default library will be used !
     *
     * @return 		boolean, true if succesfull !
     *
     * @see	GLContext#defGljLib   
     *
     * @see	GLContext#defGLFuncLib 
     *
     * @see	GLContext#defGLUFuncLib 
     */
    public static boolean loadNativeLibraries ( String gljLibName,
    						String glLibName,
						String gluLibName
					      )
    {
        if(libsLoaded) return true;

	String libNames[] = null;

        jvmVendor = java.lang.System.getProperty("java.vendor");
        jvmVersion = java.lang.System.getProperty("java.version");

        if(gljClassDebug)
	{
		System.out.println("jvm vendor: "+jvmVendor);
		System.out.println("jvm version: "+jvmVersion);
        }

	int i0 = 0;
	int i1 = jvmVersion.indexOf(".", i0);
        String strhlp = null;
	if(i1>0)
	{
	    strhlp = jvmVersion.substring(i0,i1);
	    try {
	      jvmVersionMajor = Integer.valueOf(strhlp).intValue();
	    } catch (Exception e) 
	    {System.out.println("Not a number: "+strhlp+" ("+jvmVersion+")");}
	}
	i0 = i1+1;
	i1 = jvmVersion.indexOf(".", i0);
	if( i1 < 0 )
		i1 = jvmVersion.length(); // no 2nd dot, no bug version number

	if( 0<i0 && i0<i1 )
	{
	    strhlp = jvmVersion.substring(i0,i1);
	    try {
	      jvmVersionMinor = Integer.valueOf(strhlp).intValue();
	    } catch (Exception e) 
	    {System.out.println("Not a number: "+strhlp+" ("+jvmVersion+")");}
	}

        if(gljClassDebug)
	{
		System.out.println("jvm version (parsed): "+
				   "major: "+jvmVersionMajor+
		                   ", minor: "+jvmVersionMinor);
        }

        isNetscapeJvm = jvmVendor!=null && jvmVendor.indexOf("Netscape")>=0 ;
        isMicrosoftJvm = jvmVendor!=null && jvmVendor.indexOf("Microsoft")>=0 ;

 	// Determine the OS
 	osName = System.getProperty( "os.name" );
 	if( osName.startsWith( "Wind" ) )
	   osType = OsWindoof;
 	else if( osName.startsWith( "Mac OS" ) )
	   osType = OsMac;
	else /* oops - lets guess unix/x11 :-) */
	   osType = OsX11;

	String jniEXTsuff = "";

	if( jvmVersionMajor>=2 ||
	       ( jvmVersionMajor==1 && jvmVersionMinor>=2 )
	  )
	{
		jniEXTsuff = "12";
	}

	if(gljLibName==null)
	    gljLibName = defGljLib+jniEXTsuff;
	if(glLibName==null)
	    glLibName  = defGLFuncLib+jniEXTsuff;
	if(gluLibName==null)
	    gluLibName = defGLUFuncLib+jniEXTsuff;

	if ( (osType==OsWindoof) && (isMicrosoftJvm) )
	{
	   // JDirect loads the GL libraries automatically,
	   // so we don't have to.
	   libNames = new String[4];
	   libNames[0]= gljLibName;
	   libNames[1]= glLibName;
	   libNames[2]= gluLibName;
	   libNames[3]= defGljMSWinLib;
	   useMSJDirect = true;
	} else {
	   /* For MAC, Win32+SunJVM, Unices ... 
	    */
	   libNames = new String[3];
	   libNames[0]= gljLibName;
	   libNames[1]= glLibName;
	   libNames[2]= gluLibName;
	   useMSJDirect = false;
	}

	if(isNetscapeJvm)
	{
	  System.out.println("Netscape JVM try to get Privileges");
	  try {
	        Class privmgr = 
			Class.forName("netscape.security.PrivilegeManager");
		Class[] parameterTypes = new Class[1];
		parameterTypes[0] = Class.forName("java.lang.String");
		Method m = privmgr.getMethod("enablePrivilege",parameterTypes);
		Object args[] = new Object[1];
		args[0] = (Object)(new String("UniversalLinkAccess"));
		m.invoke(privmgr,args);
		/*
		netscape.security.PrivilegeManager.enablePrivilege
			("UniversalLinkAccess");
		*/
		System.out.println("Netscape-Privilege: enabled UniversalLinkAccess priv.");
	  } catch (Exception ex) 
	  { 
		System.out.println("Not enabled Netscape-Privilege: UniversalLinkAccess priv.");
	  }
	}

	/* load libs */
	int libNumber = 0;
	String _libName = null ;
        boolean libLoaded[] = new boolean[libNames.length];

	for(libNumber=0; libNumber<libNames.length; libNumber++)
	    libLoaded[libNumber]=false;

	for(libNumber=0; libNumber<libNames.length; libNumber++)
	{
		do {
		      try {
			System.loadLibrary( libNames[libNumber] );  
			libLoaded[libNumber]=true;
			if(gljClassDebug)
			{
			    System.out.println("loaded native library: "+
			    			libNames[libNumber]);
			}
		      } catch ( UnsatisfiedLinkError e) {
			System.out.println
			( "Sorry, can't find the library: "+
			  libNames[libNumber]+"\n"+e );
			
			libNames[libNumber]=null; // stop trying ... :-(
		      }
		} while( libLoaded[libNumber]==false && 
		         libNames[libNumber]!=null );
	}

	for(libNumber=0; libNumber<libNames.length; libNumber++)
	{
		if(libLoaded[libNumber]==false) break;
	}
	if(libNumber==libNames.length) 
	{
		libsLoaded=true;
	}

	return libsLoaded;
    }
 
    /** 
     * no no no .. the user has to choose !
     *
     * The user must call loadNativeLibrary !
     * 
     * @see GLContext#loadNativeLibrary
     *
     * static {
     * 	if(!libLoaded)
     * 		loadNativeLibrares(null, null, null);
     * }
     */

    /**
     * Test to load the native library, GLFunc and GLUFunc implementation !
     * If succesfull, a Frame will created and the GL-Infos (vendor, ...)
     * are shown in it !
     *
     * @param args, a list of args, 
     *
     *    -gljlib   <glj-libname> gl4java-glj-lib native library
     *    -gllib    <gl-libname> gl4java-gl-lib native library
     *    -glulib   <glu-libname> gl4java-glu-lib native library
     *    -glclass  <gl-class> gl4java-gl-class java GLFunc implementation
     *    -gluclass <glu-class> gl4java-glu-class java GLUFunc implementation
     *    -info     creates a GLContext and prints all avaiable information of GL/GLU and GL4Java
     *    -infotxt  like -info, but exits straight after -info !
     *
     *    without any arguments, a help screen is shown 
     */
    public static void main( String args[] ) 
    {
     	String gljLibName = null;
     	String glLibName = null;
     	String gluLibName = null;
     	String glName = defGLFuncClass;
     	String gluName = defGLUFuncClass;
	boolean info=false;
	boolean exitImmediatly=false;
	int i = 0;
	boolean ok=true;

	if(args.length==0)
	{
		System.out.println("usage: java gl4java.GLContext <options>, where options can be: ");
		System.out.println("	-gljlib <glj-libname> \t choose a custom the gl4java-glj-lib native library (default: GL4JavaJauGljJNI)");
		System.out.println("	-gllib <gl-libname> \t choose a custom the gl4java-gl-lib native library (default: GL4JavaJauGLJNI)");
		System.out.println("	-glulib <glu-libname> \t choose a custom the gl4java-glu-lib native library (default: GL4JavaJauGLUJNI");
		System.out.println("	-glclass <gl-class> \t choose a custom the gl4java-gl-class java GLFunc implementation (default: GLFuncJauJNI)");
		System.out.println("	-gluclass <glu-class> \t choose a custom the gl4java-glu-class java GLUFunc implementation (default: GLUFuncJauJNI)");
		System.out.println("	-info \t creates a GLContext and prints all avaiable information of GL/GLU and GL4Java");
		System.out.println("	-infotxt \t like -info, but exits straight after -info !");
	        System.exit(0);
	}

	while(args.length>i)
	{
		if(args[i].equals("-gljlib")) {
			if(args.length>++i) gljLibName=args[i];
		} else if(args[i].equals("-gllib")) {
			if(args.length>++i) glLibName=args[i];
		} else if(args[i].equals("-glulib")) {
			if(args.length>++i) gluLibName=args[i];
		} else if(args[i].equals("-glclass")) {
			if(args.length>++i) glName=args[i];
		} else if(args[i].equals("-gluclass")) {
			if(args.length>++i) gluName=args[i];
		} else if(args[i].equals("-info")) {
			info=true;
		} else if(args[i].equals("-infotxt")) {
			info=true;
			exitImmediatly=true;
		} else {
		  System.out.println("illegal arg "+i+": "+args[i]);
		  ok=false;
		}
		i++;
	}

	GLContext.gljNativeDebug = true;
	GLContext.gljClassDebug = true;

	GLFunc  gl = null;
	GLUFunc glu = null;

	if(GLContext.loadNativeLibraries(gljLibName, glLibName, gluLibName))
		System.out.println("native Libraries loaded succesfull");
	else {
		System.out.println("native library NOT loaded complete");
		ok=false;
	}

	if( (gl=GLContext.createGLFunc(glName)) !=null)
		System.out.println("GLFunc implementation "+glName+" created succesfull");
	else {
		System.out.println("GLFunc implementation "+glName+" not created");
		ok=false;
	}
	if( (glu=GLContext.createGLUFunc(gluName)) !=null)
		System.out.println("GLUFunc implementation "+gluName+" created succesfull");
	else {
	        System.out.println("GLUFunc implementation "+gluName+" not created");
		ok=false;
	}

	if( info && ok==true) {
		Frame f = new Frame("GL4Java Info");
		f.setSize(10, 10);

		f.pack();
		f.setVisible(true);

		GLContext glj = new GLContext(f, gl, glu);

		Frame fInfo = glj.gljShowVersions();

                fInfo.addWindowListener
		                   ( new WindowAdapter()
                                      {
                                        public void windowClosed(WindowEvent e)
                                        {
                                           // button exit
                                           System.exit(0);
                                        }
                                      }
                                    );              

	        glj.gljDestroy();

		if(exitImmediatly)
		   System.exit(0);
	}
    }
		
    public static String getJVMVendor() { return jvmVendor; }
    public static boolean isNetscapeJVM() { return isNetscapeJvm; }
    public static boolean isMicrosoftJVM() { return isMicrosoftJvm; }
 
    /**
     * Used to hold the user given GLFunc implementation
     */
    private GLFunc gl 	= null;

    /**
     * Used to hold the user given GLUFunc implementation
     */
    private GLUFunc glu = null;

   /**
    *
    * Constructor
    *
    * This privat constructor is for all possible
    * compinations and is called from the customized
    * constructors.
    *
    *  First the GLContext is fetched from the Component itself !
    * To do so, the Component is set visible if it is not !
    *
    * If a GLContext is fetched, it is current !
    *
    * @param comp	  the users component for the gl-context
    * @param glf	  the users selected GLFunc implementation
    * @param glf	  the users selected GLUFunc implementation
    * @param _createOwnWindow the flag for the visual property
    * @param _offScreenRenderer the flag for the visual property
    * @param _doubleBuffer the flag for the visual property
    * @param _stereoView  the flag for the visual property
    * @param _rgba	  the flag for the visual property
    * @param _stencilBits the flag for the visual property
    * @param _accumSize   the flag for the visual property
    * @param _sharedGLContext the shared GLContext
    * @param _offScrnSize the fixed offscreen pixmap size
    *
    */
    protected GLContext( Component comp, GLFunc glf, GLUFunc gluf, 
		         boolean _createOwnWindow, boolean _offScreenRenderer,
                         boolean _doubleBuffer, boolean _stereoView,
		         boolean _rgba,
		         int _stencilBits,
		         int _accumSize,
		         GLContext _sharedGLContext,
    			 Dimension _offScrnSize
                       )
    {
		super( );

		_comp = comp ;  // the light- or heavy component
		gl    = glf ;
		glu   = gluf ;
	        createOwnWindow = _createOwnWindow;
	        offScreenRenderer = _offScreenRenderer;
		doubleBuffer=_doubleBuffer;
		stereoView=_stereoView;
		rgba=_rgba;
		stencilBits=_stencilBits;
		accumSize=_accumSize;
		offScrnSize= _offScrnSize;

		this.sharedGLContext  = _sharedGLContext;
		if(sharedGLContext != null) 
			sharedGLContextNative =
				(int)sharedGLContext.getNativeGLContext();

		// fetch the heavy peer component in temporary var. comp
		while(comp!=null &&
		      (comp.getPeer() instanceof java.awt.peer.LightweightPeer)
		     )
			comp=comp.getParent();

		_compHeavy = comp ;  // the heavy component

    		Graphics  _gr = null;

		if(_compHeavy!=null)
		{
			if( ! _comp.isVisible() )
				setVisible(true); // use our own ...


			_gr = _compHeavy.getGraphics();
			if(_gr==null)
			  System.out.println("got empty Graphics");
		} else
		  System.out.println("got empty Component");

		if(_comp!=null && _gr!=null)
		{
			int i = 0;
			do {
				createGLContext(_gr); // uses _comp
				if(gljIsInit()==false)
				{
				    try
				    {
				      Thread.sleep( 100 );
				    }
				    catch( Exception e )
				    { }
				}
				i++;
			} while(gljIsInit()==false && i<5) ;
		}

	        if(gljClassDebug)
		{
			if(gljIsInit())
			  System.out.println(">>> GLContext() succeded");
			else
			  System.out.println(">>> GLContext() failed");
		}
    }

   /**
    *
    * Constructor
    *
    * First the GLContext is fetched from the Component itself !
    * To do so, the Component is set visible if it is not !
    *
    * If a GLContext is fetched, it is current !
    *
    * @param comp	  the users component for the gl-context
    * @param glf	  the users selected GLFunc implementation
    * @param glf	  the users selected GLUFunc implementation
    * @param _createOwnWindow the flag for the visual property
    * @param _doubleBuffer the flag for the visual property
    * @param _stereoView  the flag for the visual property
    * @param _rgba	  the flag for the visual property
    * @param _stencilBits the flag for the visual property
    * @param _accumSize   the flag for the visual property
    * @param _sharedGLContext the shared GLContext
    *
    */
    public GLContext( Component comp, GLFunc glf, GLUFunc gluf, 
		      boolean _createOwnWindow,
                      boolean _doubleBuffer, boolean _stereoView,
		      boolean _rgba,
		      int _stencilBits,
		      int _accumSize,
		      GLContext _sharedGLContext
                    )
    {
    	this(comp, glf, gluf, 
	      _createOwnWindow, false /* offscreen renderer */,
	      _doubleBuffer,
	      _stereoView,
	      _rgba,
	      _stencilBits,
	      _accumSize,
	      _sharedGLContext,
	      null /* offscreen size */
	    );
    }

   /**
    *
    * Constructor
    *
    * First the GLContext is fetched from the Component itself !
    * To do so, the Component is set visible if it is not !
    *
    * If a GLContext is fetched, it is current !
    *
    * @param comp	  the users component for the gl-context
    * @param glf	  the users selected GLFunc implementation
    * @param glf	  the users selected GLUFunc implementation
    * @param _createOwnWindow the flag for the visual property
    * @param _doubleBuffer the flag for the visual property
    * @param _stereoView  the flag for the visual property
    * @param _rgba	  the flag for the visual property
    * @param _stencilBits the flag for the visual property
    * @param _accumSize   the flag for the visual property
    *
    */
    public GLContext( Component comp, GLFunc glf, GLUFunc gluf, 
		      boolean _createOwnWindow,
                      boolean _doubleBuffer, boolean _stereoView,
		      boolean _rgba,
		      int _stencilBits,
		      int _accumSize
                    )
    {
    	this(comp, glf, gluf, 
	      _createOwnWindow, false /* offscreen renderer */,
	      _doubleBuffer,
	      _stereoView,
	      _rgba,
	      _stencilBits,
	      _accumSize,
	      null /* sharedGLContext */,
	      null /* offscreen size */
	    );
    }

   /**
    *
    * Constructor
    *
    * First the GLContext is fetched from the Component itself !
    * To do so, the Component is set visible if it is not !
    *
    * If a GLContext is fetched, it is current !
    *
    * @param comp	  the users component for the gl-context
    * @param glf	  the users selected GLFunc implementation
    * @param glf	  the users selected GLUFunc implementation
    * @param _createOwnWindow the flag for the visual property
    * @param _doubleBuffer the flag for the visual property
    * @param _stereoView  the flag for the visual property
    * @param _rgba	  the flag for the visual property
    * @param _stencilBits the flag for the visual property
    *
    */
    public GLContext( Component comp, GLFunc glf, GLUFunc gluf, 
		      boolean _createOwnWindow,
                      boolean _doubleBuffer, boolean _stereoView,
		      boolean _rgba,
		      int _stencilBits
                    )
    {
    	this(comp, glf, gluf, 
	      _createOwnWindow, false /* offscreen renderer */,
	      _doubleBuffer,
	      _stereoView,
	      _rgba,
	      _stencilBits,
	      0 /* accumSize */,
	      null /* sharedGLContext */,
	      null /* offscreen size */
	    );
    }

   /**
    *
    * Constructor
    *
    * First the GLContext is fetched from the Component itself !
    * To do so, the Component is set visible if it is not !
    *
    * If a GLContext is fetched, it is current !
    *
    * @param comp	  the users component for the gl-context
    * @param glf	  the users selected GLFunc implementation
    * @param glf	  the users selected GLUFunc implementation
    * @param _doubleBuffer the flag for the visual property
    * @param _stereoView  the flag for the visual property
    * @param _rgba	  the flag for the visual property
    * @param _stencilBits the flag for the visual property
    *
    */
    public GLContext( Component comp, GLFunc glf, GLUFunc gluf, 
                      boolean _doubleBuffer, boolean _stereoView,
		      boolean _rgba,
		      int _stencilBits,
		      int _accumSize
                    )
    {
    	this(comp, glf, gluf, 
	      false /* ownWindow */, false /* offscreen renderer */,
	      _doubleBuffer,
	      _stereoView,
	      _rgba,
	      _stencilBits,
	      _accumSize,
	      null /* sharedGLContext */,
	      null /* offscreen size */
	    );
    }

   /**
    *
    * Constructor
    *
    * First the GLContext is fetched from the Component itself !
    * To do so, the Component is set visible if it is not !
    *
    * If a GLContext is fetched, it is current !
    *
    * @param comp	  the users component for the gl-context
    * @param glf	  the users selected GLFunc implementation
    * @param glf	  the users selected GLUFunc implementation
    * @param _doubleBuffer the flag for the visual property
    * @param _stereoView  the flag for the visual property
    * @param _rgba	  the flag for the visual property
    * @param _stencilBits the flag for the visual property
    *
    */
    public GLContext( Component comp, GLFunc glf, GLUFunc gluf, 
                      boolean _doubleBuffer, boolean _stereoView,
		      boolean _rgba,
		      int _stencilBits
                    )
    {
    	this(comp, glf, gluf, 
	      false /* ownWindow */, false /* offscreen renderer */,
	      _doubleBuffer,
	      _stereoView,
	      _rgba,
	      _stencilBits,
	      0 /* accumSize */,
	      null /* sharedGLContext */,
	      null /* offscreen size */
	    );
    }

   /**
    *
    * Constructor
    *
    * First the GLContext is fetched from the Component itself !
    * To do so, the Component is set visible if it is not !
    *
    * If a GLContext is fetched, it is current !
    *
    * @param comp	  the users component for the gl-context
    * @param glf	  the users selected GLFunc implementation
    * @param glf	  the users selected GLUFunc implementation
    * @param _doubleBuffer the flag for the visual property
    * @param _stereoView  the flag for the visual property
    * @param _rgba	  the flag for the visual property
    * @param _stencilBits the flag for the visual property
    *
    */
    public GLContext( Component comp, GLFunc glf, GLUFunc gluf, 
                      boolean _doubleBuffer, boolean _stereoView,
		      boolean _rgba
                    )
    {
    	this(comp, glf, gluf, 
	      false /* ownWindow */, false /* offscreen renderer */,
	      _doubleBuffer,
	      _stereoView,
	      _rgba,
	      0, /* _stencilBits */
	      0 /* accumSize */,
	      null /* sharedGLContext */,
	      null /* offscreen size */
	    );
    }

   /**
    *
    * Constructor
    *
    * First the GLContext is fetched from the Component itself !
    * To do so, the Component is set visible if it is not !
    *
    * If a GLContext is fetched, it is current !
    *
    * ! WARNING ! This flag is just for testing purpose !!!
    *
    * @param comp	  the users component for the gl-context
    * @param glf	  the users selected GLFunc implementation
    * @param glf	  the users selected GLUFunc implementation
    * @param _doubleBuffer the flag for the visual property
    * @param _stereoView  the flag for the visual property
    *
    */
    public GLContext( Component comp, GLFunc glf, GLUFunc gluf, 
                      boolean _doubleBuffer, boolean _stereoView
                    )
    {
    	this(comp, glf, gluf, 
	      false /* ownWindow */, false /* offscreen renderer */,
	      _doubleBuffer,
	      _stereoView,
	      true /* _rgba */,
	      0, /* _stencilBits */
	      0 /* accumSize */,
	      null /* sharedGLContext */,
	      null /* offscreen size */
	    );
    }

   /**
    *
    * Constructor
    *
    * First the GLContext is fetched from the Component itself !
    * To do so, the Component is set visible if it is not !
    *
    * We use a visual with doubleBuffer and NO stereoView !
    * Do not force a new native window !
    *
    * If a GLContext is fetched, it is current !
    *
    * @param comp	the users component for the gl-context
    * @param glf	the users selected GLFunc implementation
    * @param glf	the users selected GLUFunc implementation
    */
    public GLContext( Component comp, GLFunc glf, GLUFunc gluf )
    {
    	this(comp, glf, gluf, 
	      false /* ownWindow */, false /* offscreen renderer */,
	      true /* _doubleBuffer */,
	      false /* _stereoView */,
	      true /* _rgba */,
	      0, /* _stencilBits */
	      0 /* accumSize */,
	      null /* sharedGLContext */,
	      null /* offscreen size */
	    );
    }

   /**
    *
    * Constructor Function for offscreen rendering !
    *
    * First the GLContext is fetched from the Component itself !
    * To do so, the Component is set visible if it is not !
    *
    * If a GLContext is fetched, it is current !
    *
    * @param comp	  the users component for the gl-context
    * @param glf	  the users selected GLFunc implementation
    * @param glf	  the users selected GLUFunc implementation
    * @param _stereoView  the flag for the visual property
    * @param _rgba	  the flag for the visual property
    * @param _stencilBits the flag for the visual property
    * @param _sharedGLContext the shared GLContext
    *
    * @return             the created offscreen context
    */
    public static final GLContext createOffScreenCtx
    		       ( Component comp, GLFunc glf, GLUFunc gluf, 
                         boolean _stereoView,
		         boolean _rgba,
		         int _stencilBits,
		         int _accumSize,
		         GLContext _sharedGLContext
                       )
    {
    	return new GLContext(comp, glf, gluf, 
		      false /* _createOwnWindow */, 
		      true /* offscreen renderer */,
		      false /* _doubleBuffer */,
		      _stereoView,
		      _rgba,
		      _stencilBits,
		      _accumSize,
		      _sharedGLContext,
		      null
		    );
    }

   /**
    *
    * Constructor Function for offscreen rendering !
    *
    * First the GLContext is fetched from the Component itself !
    * To do so, the Component is set visible if it is not !
    *
    * If a GLContext is fetched, it is current !
    *
    * @param comp	  the users component for the gl-context
    * @param glf	  the users selected GLFunc implementation
    * @param glf	  the users selected GLUFunc implementation
    * @param _stereoView  the flag for the visual property
    * @param _rgba	  the flag for the visual property
    * @param _stencilBits the flag for the visual property
    * @param _sharedGLContext the shared GLContext
    * @param _offScrnSize the fixed offscreen pixmap size
    *
    * @return             the created offscreen context
    */
    public static final GLContext createOffScreenCtx
    		       ( Component comp, GLFunc glf, GLUFunc gluf, 
                         boolean _stereoView,
		         boolean _rgba,
		         int _stencilBits,
		         int _accumSize,
		         GLContext _sharedGLContext,
    			 Dimension _offScrnSize
                       )
    {
    	return new GLContext(comp, glf, gluf, 
		      false /* _createOwnWindow */, 
		      true /* offscreen renderer */,
		      false /* _doubleBuffer */,
		      _stereoView,
		      _rgba,
		      _stencilBits,
		      _accumSize,
		      _sharedGLContext,
		      _offScrnSize
		    );
    }

    /**
     * Used to set the user given GLFunc implementation
     */
    public final void setGLFunc(GLFunc _gl) { gl = _gl; }

    /**
     * Used to set the user given GLUFunc implementation
     */
    public final void setGLUFunc(GLUFunc _glu) { glu = _glu; }

    /**
     * Used to return the user given GLFunc implementation
     */
    public final GLFunc getGLFunc() { return gl; }

    /**
     * Used to return the user given GLUFunc implementation
     */
    public final GLUFunc getGLUFunc() { return glu; }

    /**
     * Support of loading a vendors GLFunc implementation
     *
     * Try to load the Class, if succesfull we do return the instance of it.
     * Else null is returned !
     *
     * The Class-Name is: "GL4Java." + vendorClass + ".class" !
     *
     * @param vendorClass  The name of the GLFunc implementation.
     *                     If vendorSuffix==null, the default implementation 
     *			   "GLFuncJauJNI" (-> GL4Java.GLFuncJauJNI.class ) 
     *			   will be used !
     *
     * @return 		GLFunc, the implementation's instance if exists 
     *			and valid, or null
     *
     * @see	GLContext#defGLFuncClass   
     */
    public static final GLFunc createGLFunc(String vendorClass)
    {
        String access_name = "gl4java.";
	GLFunc gl = null;
	Object clazz = null;

	if(vendorClass==null) 
	{
	    vendorClass = defGLFuncClass ;
	}

	String clazzName   = access_name + vendorClass ;

	try {
		clazz = Class.forName(clazzName).newInstance();
	} catch (Exception ex) {
		// thats ok :-)
		System.out.println("could not create instance of: "+ clazzName);
	}
	if(clazz !=null && (clazz instanceof GLFunc))
		gl = (GLFunc) clazz;
	else
		System.out.println("Not a GLFunc implementation: "+ clazzName);

	return gl;
    }

    /**
     * Support of loading a vendors GLUFunc implementation
     *
     * Try to load the Class, if succesfull we do return the instance of it.
     * Else null is returned !
     *
     * The Class-Name is: "GL4Java." + vendorClass + ".class" !
     *
     * @param vendorClass  The name of the GLUFunc implementation.
     *                     If vendorSuffix==null, the default implementation 
     *			   "GLUFuncJauJNI" (-> GL4Java.GLUFuncJauJNI.class ) 
     *			   will be used !
     *
     * @return 		GLUFunc, the implementation's instance if exists 
     *			and valid, or null
     *
     * @see	GLContext#defGLUFuncClass   
     */
    public static final GLUFunc createGLUFunc(String vendorClass)
    {
        String access_name = "gl4java.";
	GLUFunc glu = null;
	Object clazz = null;

	if(vendorClass==null) 
	{
	    vendorClass = defGLUFuncClass ;
	}


	String clazzName   = access_name + vendorClass ;

	try {
		clazz = Class.forName(clazzName).newInstance();
	} catch (Exception ex) {
		// thats ok :-)
		System.out.println("could not create instance of: "+ clazzName);
	}
	if(clazz!=null && (clazz instanceof GLUFunc))
		glu = (GLUFunc) clazz;
	else
		System.out.println("Not a GLUFunc implementation: "+ clazzName);
		

	return glu;
    }

   /**
    *
    * Own setVisible
    * This one set's us visible - and wait's for that result !
    *
    * @param visible	boolean: visible==true, hide==false
    * @return 		void
    */ 
    public void setVisible( boolean visible )
    {
    	    int i= 0;

	    _comp.setVisible( visible );

	    while( _comp.isVisible() != visible  && i<5) 
	    {
		_comp.setVisible( visible );

	        try
	        {
		    Thread.sleep( 100 );
	        }
	        catch( Exception e )
	        {
		    System.out.println( "GLContext:setVisible: Error - " + e );
	        }
		i++;
	    }
	    if(i>=5)
	      System.out.println( "GLContext:setVisible: Error, could not set to "+visible); 
    }

   /**
    *
    * createGLContext gets the window handle and calls gljInit,
    * so the gl-context will be initialised here.
    *
    * this method will be invoked by the constructor
    *
    * this method is left public - this time,
    * to allow the user to to it again later - if it was not succesfull !
    *
    * @param g		the graphics reference, 
    *			where we will get the native window handle from.
    *
    * @return 		void
    *
    * @see GLContext#GLContext
    */ 
    public final void createGLContext(Graphics g)
    {
        String access_name = "gl4java.jau.awt.";
        WinHandleAccess win_access = null;

	try {
	    if(gljClassDebug)
	      System.out.println(">>> createGLContext");
 
          if(pData == 0)
	  {
	    if ( useMSJDirect )
	    {
	          if(gljClassDebug)
			  System.out.println("using MSJDirect ...");

		  win_access = (WinHandleAccess)
		    Class.forName(access_name + "windows.MSWin32HandleAccess").newInstance();
                  /* _comp should be a subclass of Canvas, and its parent
                     class should be of type Panel, Frame or Window.  If not,
                     this all falls apart. */

		  /* This part is now rewritten, 
	             to respect direkt Windows (Frames and Dialogs)
		     and Applets .. */

                  Component ob = _comp;

		  while ( (ob instanceof Window)==false &&
		  	  (ob instanceof Applet)==false
			)
		  {
                      ob = ob.getParent();
                  }

		  containerWindow = (Container)ob;

		  /* refetch the Graphics component */
		  g = ob.getGraphics();
		  if(g==null)
		    System.out.println("GL4Java-MSJVM: got empty Graphics");

		  pData = (int)win_access.getWinHandle(ob,g);

		  if (pData != 0)
		  {
			Point p1;
			try
			{
				p1 = _comp.getLocationOnScreen();
			}
			catch (Exception e)
			{
				p1 = _comp.getLocation();
				Point p2 = containerWindow.getLocation();
				p1.x += p2.x;
				p1.y += p2.y;
				Insets is = containerWindow.getInsets();
				p1.x += is.left;
				p1.y += is.top;
			}
			Rectangle r = _comp.getBounds();
			createwinx = p1.x;
			createwiny = p1.y;
			createwinw = r.width;
			createwinh = r.height;
			windowHandle = 0;
			threadRunning = true;
			destroyWindow = false;
			Thread th = new Thread(this);
			th.start();
			while ( (windowHandle == 0) && (threadRunning) )
			{
				try
				{
					Thread.currentThread().sleep(100);
				}
				catch( Exception e )
				{ }
			}
		  }
 	    } else if(osType==OsWindoof)
	    {
		  win_access = (WinHandleAccess) 
		    Class.forName(access_name + "windows.Win32HandleAccess").newInstance();
		  pData = (int) win_access.getWinHandle(_compHeavy, g);
		  windowHandle = pData;
	    }
            else if(osType==OsMac)
            {
		  win_access = (WinHandleAccess)
			Class.forName(access_name + "macintosh.MacHandleAccess").newInstance();
		  pData = (int) win_access.getWinHandle(_compHeavy, g);
		  windowHandle = pData;
            }     
	    else /* X11 */
	    {
		  win_access = (WinHandleAccess) 
		    Class.forName(access_name + "motif.X11HandleAccess").newInstance();
		  pData = (int) win_access.getWinHandle(_compHeavy, g);
		  windowHandle = pData;
	    }
	  }

	  if(offScrnSize!=null)
	  {
		  createwinw = offScrnSize.width;
		  createwinh = offScrnSize.height;
	  } else {
		  Rectangle r = _comp.getBounds();
		  createwinw = r.width;
		  createwinh = r.height;
	  }

	  /* try to establish a context to OpenGL */
	  try 
	  {
		    gljInit();
	  }
	  catch( GL4JavaInitException e ) 
	  {
		    System.out.println( "can't create a GL context\n");
	  }
    
	} catch (Exception e) {
	      System.out.println( "An exception is thrown, while creating a GL context\n");
	      System.out.println(e);
	      e.printStackTrace();
	}
    }

    /* glj* stuff */
    			
   /**
    *
    * Initializes the gl-context. 
    * gljInit is called by createGLContext (which is calles by the first paint)!
    *
    * Also gljInit will call the init method after GL initialisation,
    * so the user can override �init� to initialize his own stuff !
    *
    * @return 		void
    * @exception 	GL4Java.GL4JavaInitException 
    *			this class throws an exception 
    *			if the native call to create a OpenGL context failed.
    * @see GLContext#createGLContext
    * @see gl4java.awt.GLCanvas#paint
    * @see gl4java.awt.GLCanvas#init
    */ 
    protected final synchronized void gljInit() 
      throws GL4JavaInitException 
    {
	if( libsLoaded==false ) return ;

	if(pData==0 && !offScreenRenderer)
	{
	    System.out.println("could not open a GL widget -- Win CONTEXT");
            throw new GL4JavaInitException ();
	}

	if(gljClassDebug)
	  System.out.println(">>> gljInit");

        if( openOpenGLNative() == false ) 
        {
	    if ( useMSJDirect )
	    {
		destroyWindow = true;
		while (threadRunning)
		{
			try
			{
				Thread.currentThread().sleep(100);
			}
			catch( Exception e )
			{ }
		}
		pData = 0;
		windowHandle = 0;
	    }
	    System.out.println("could not open a GL widget -- GL CONTEXT");
            throw new GL4JavaInitException ();
          } else {
	    isInitialized = true;
	}
    }

    /**
     * For MSJVM Only !
     *
     * This functions fetches the window-handle within a special thread !
     */
    public void run()
    {
	if ( !useMSJDirect )
	{
		System.err.println("GL4Java-MSJVM-Run: INTERNAL ERROR"); 
		System.exit(0);
	}

	pData = gl4java.system.GljMSJDirect.createOGLWindowNative( 
					      pData,
	                                      createwinx,createwiny,
					      createwinw,createwinh);
	if (pData != 0)
	{
		windowHandle = pData;
		while (!destroyWindow)
		{
			gl4java.system.GljMSJDirect.OGLWindowMsgPump();
			try
			{
				Thread.currentThread().sleep(10);
			}
			catch( Exception e )
			{ }
		}
		destroyWindow = false;
		gl4java.system.GljMSJDirect.destroyOGLWindowNative(
								windowHandle);
		windowHandle = 0;
		pData = 0;
		gl4java.system.GljMSJDirect.OGLWindowMsgPump();
	}
	threadRunning = false;
    }

   /**
    *
    * Checks if the gl-context is Initializes
    * If returns true,
    * gljInit is allready called and a valid gl-context is achieved.
    *
    * No glMakeCurrent is done - 
    * like gljMakeCurrent (important for more gl-context) !
    * 
    * <p>
    *
    * The user can use this method to check if he can start rendering
    * and to be sure his initialisation (init) is done !
    *
    * <p>
    *
    * If you use gl4java.awt.GLCanvas, you should use the cvsIsInit
    * method !
    * <p>
    *
    * @return 		boolean
    * @see GLContext#gljInit
    * @see gl4java.awt.GLCanvas#cvsIsInit
    */ 
    public final boolean gljIsInit() 
    {
	return isInitialized;
    }

    /**
     * Resizes the gl-viewport
     *
     * Should be called, if the component is resized.
     * The user should take advantage of this functionality.
     *
     * Be sure to resize not within the event-method of the
     * ComponentHandler, you better resize while normal painting.
     * This can be done while using a boolean flag ;-)
     * 
     * Look at GLComponent !
     */
    public final void gljResize(int width, int height)
    {
    	if ( ! isInitialized || !glEnabled ) return;

	if(offScreenRenderer)
	{
		//JAU: TODO
		return;
	}

	if ( useMSJDirect )
        {
		try
		{
			Point p = _comp.getLocationOnScreen();
			gl4java.system.GljMSJDirect.moveOGLWindowNative(
					     windowHandle,p.x,p.y,width,height);
		}
		catch (Exception e)
		{ }
	}
        else
                gljResizeNative( createOwnWindow,
		                 displayHandle, windowHandle,
		                 width,height);
    }

    private final native void gljResizeNative( boolean isOwnWindow,
				               int disp, int thisWin,
				               int width, int height );

    /**
     * native C function to open the OpenGLwidget
     */
    protected final native boolean openOpenGLNative();

    /**
     * native C function to check the gl types.
     * At this time, all GL* types will be checked if they fit's
     * in the used java JNI types.
     *
     * this checks is allready performed, while the GL context is
     * fetched with gljInit !
     *
     * BUT we used this function, to perform a check without an
     * X11-connection to our AIX host ;-))
     * So a call to this function is not needed !
     */
    public static final boolean gljCheckGLTypes()
    {
        return gljCheckGLTypesNative();
    }

    private static final native boolean gljCheckGLTypesNative();

    public final boolean gljCheckGL()
    {
	int ec = gl.glGetError();

	if(ec!=GLFunc.GL_NO_ERROR)
	{
		String errStr = glu.gluErrorString(ec);

		try
		{
		   throw new Exception();
		}
		catch (Exception e)
		{
		   System.out.println("GL ERROR : "+errStr);
		   System.out.println("GL ERROR : "+ec+" == 0x"+Integer.toHexString(ec));
		   e.printStackTrace();
		   System.out.println();
		   System.out.flush();
		}

		return false;
	}
	return true;
    }

   /**
    *
    * gljMakeCurrent checks whether GL4Java is initializes 
    * AND makes the GL-Context current for this thread.
    *
    * It's more save to use �gljMakeCurrent�, instead of
    * �gljMakeCurrentNative�, because we do check if GL is initalised !
    *
    * @return 		boolean
    */ 
    public final boolean gljMakeCurrent()
    {
    	if ( ! isInitialized || !glEnabled )
	    return false;

        return  gljMakeCurrentNative( displayHandle,
				      windowHandle,
				      glContext);
    }


   /**
    *
    * gljMakeCurrent checks whether GL4Java is initializes 
    * AND makes the GL-Context current for this thread.
    *
    * It's more save to use �gljMakeCurrent�, instead of
    * �gljMakeCurrentNative�, because we do check if GL is initalised !
    *
    * @param	freeContextFirst is obsolete !
    *
    * @return 		boolean
    *
    * @deprecated The argument freeContextFirst is obsolete !
    */ 
    public final boolean gljMakeCurrent(boolean freeContextFirst)
    {
    	if ( ! isInitialized || !glEnabled )
	    return false;

        return  gljMakeCurrentNative( displayHandle,
				      windowHandle,
				      glContext);
    }

    private static final native boolean gljMakeCurrentNative(
    						int disp, 
    					        int thisWin,
					        int glContext);

   /**
    *
    * gljGetCurrentContext fetches the current native
    * GL-Context, which is attached to this _native_ thread !
    *
    * @return 		int
    */ 
    public static final native int gljGetCurrentContext();

    /**
     *
     * gljDestroy free�s AND destroy�s the GL Context
     *
     * This function should be called when removing 
     * a GLContext !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     *
     * @return 		void
     *
     * @see GLContext#gljMakeCurrent
     * @see GLContext#gljSwap
     */ 
     public final synchronized boolean gljDestroy()
     {
        boolean result = true;

        if (!gljDestroyNative()) 
		result = false;

        windowHandle = 0;
        glContext = 0;
	pixmapHandle = 0;


	if ( useMSJDirect )
	{
		destroyWindow = false;
		gl4java.system.GljMSJDirect.destroyOGLWindowNative( pData );
		windowHandle = 0;
		gl4java.system.GljMSJDirect.OGLWindowMsgPump();
	}

        pData = 0;

        return result;
    }

     private final native boolean gljDestroyNative();

    /**
     *
     * gljFree free�s the GL Context
     *
     * This could be called after at last in your display function,
     * if you have GC problems ....
     *
     * @return 		void
     *
     * @see GLContext#gljMakeCurrent
     * @see GLContext#gljSwap
     * @see gl4java.awt.GLCanvas#sDisplay
     */ 
    public final boolean gljFree()
    {
    	if ( ! isInitialized ) return false;

        return gljFreeNative ( displayHandle,
		               windowHandle,
		               glContext);
    }

     private static final native boolean gljFreeNative( int disp, 
    					                int thisWin,
					                int glContext );

    /**
     * swap method are for double buffering
     */
    public final boolean gljSwap()
    {
    	if ( ! isInitialized ) return false;

        return gljSwapNative( displayHandle,
			      windowHandle,
			      glContext,
			      doubleBuffer);
    }

    private static final native boolean gljSwapNative( int disp, 
    					              int thisWin,
					              int glContext,
						      boolean doubleBuffer );

    /**
     * This function enables, disables the GL-Context !
     * If false is given, the openGL renderer/context is 
     * disabled and disconected (gljFree is called, if initialized) !
     *
     * If disabled, gljMakeCurrent returns always false !
     *
     * @return 	boolean
     *
     * @see	GLContext#gljIsEnabled
     * @see     GLContext#gljMakeCurrent
     */ 
    public void setEnabled(boolean b)
    {
        glEnabled = b;
    	if ( b==false && isInitialized ) 
		gljFree();
    }

    /**
     * This function queries, if the GL-Context is enabled !
     *
     * @return 	boolean
     *
     * @see	GLContext#setEnabled
     * @see     GLContext#gljMakeCurrent
     */ 
    public boolean isEnabled()
    {
        return glEnabled;
    }

    /**
     * This functions checks the existence of 
     * the GL functions !
     */
    public final static native boolean gljTestGLProc 
    					( String name, boolean verbose );

    /**
     * This functions reads the pixel from the GL frame
     * and puts it into the pixelDest array,
     * while converting them correctly to the AWT pixel format,
     * using GL_RGB[A] and BufferedImage.TYPE_INT[A]RGB !
     */
    public final static native void gljReadPixelGL2AWT (
			int x, int y, int width, int height,
			int format, int type, int bufferName,
			byte[] pixelGL, int[] pixelDest);

    /**
     * Experimental Code, not done yet !
     * This one is to upspeed the Offscreen rendering engine for e.g. Swing !
     *
     * This functions reads the pixel from the GL frame
     * and puts it into the pixelDest array,
     * while using hardware correct AWT and GL pixel format,
     * using GL_BGR[A]_EXT and BufferedImage.TYPE_[34]BYTE_[A]BGR !
     *
     * ATTENTION: This functions runs only if hardware supports this,
     * e.g. on Win32 platforms !!!
     */
    public final static native void gljReadPixelGL2AWT (
			int x, int y, int width, int height,
			int format, int type, int bufferName,
			byte[] pixelGLDest);

    /**
     * Experimental Code, not done yet !
     * This one is to upspeed the Offscreen rendering engine for e.g. Swing !
     */
    public final native void gljCpyOffScrnImg2Buffer(int width, int height, int format, byte[] pixelDest);

    /**
     * Experimental Code, not done yet !
     * This one is to upspeed the Offscreen rendering engine for e.g. Swing !
     */
    public final native void gljCpyOffScrnImg2Buffer(int width, int height, int format, int[] pixelDest);

    /**
     * native C function to achieve the native lib vendor !
     *
     * now it is possible to check the native-lib at runtime !
     */
    public final static String gljGetNativeLibVendor()
    {
        return gljGetNativeLibVendorNative();
    }

    private final static native String gljGetNativeLibVendorNative();

    /**
     * native C function to achieve the native lib version !
     *
     * now it is possible to check the native-lib at runtime !
     */
    public final static String gljGetNativeLibVersion()
    {
        return gljGetNativeLibVersionNative();
    }

    private final static native String gljGetNativeLibVersionNative();

    /**
     * function to achieve the java-class version !
     *
     * now it is possible to check the java-class at runtime !
     */
    public final static String gljGetClassVersion()
    { return version; }

    /**
     * function to achieve the java-class vendor !
     *
     * now it is possible to check the java-class at runtime !
     */
    public final static String gljGetClassVendor()
    { return "Jausoft - Sven Goethel Software Development"; }

    /**
     * function to achieve complete version info
     *
     * Be sure that the native library must be loaded !
     */
    public final String gljGetVersions()
    {
	return gljGetVersions(false);
    }

    public final String gljGetVersions(boolean verbose)
    {
      if(libsLoaded==false || gl==null || glu==null || !gljIsInit())
      	return null;

      String info1= "GL4Java - LGPL-Version"                       + "\n" +
      	            "-------------------------------------------------\n" +
      	            "-------------------------------------------------\n" +
		    "Java-Class         : GL4Java.GLContext           \n" +
		    "          : Version: "+gljGetClassVersion()   + "\n" +
		    "            Vendor : "+gljGetClassVendor()    + "\n" +
		    "Native-Library     : GL4Java.GLContext           \n" +
		    "            Version: "+gljGetNativeLibVersion()+"\n" +
		    "            Vendor : "+gljGetNativeLibVendor() +"\n" +
      	            "-------------------------------------------------\n" +
		    "Java-Class         : GL4Java.GLFunc impl.        \n" +
		    "          : Version: "+gl.getClassVersion()   + "\n" +
		    "            Vendor : "+gl.getClassVendor()    + "\n" +
		    "Native-Library     : GL4Java.GLFunc impl.        \n" +
		    "            Version: "+gl.getNativeVersion()  + "\n" +
		    "            Vendor : "+gl.getNativeVendor()   + "\n" +
      	            "-------------------------------------------------\n" +
		    "Java-Class         : GL4Java.GLUFunc impl.       \n" +
		    "          : Version: "+glu.getClassVersion()  + "\n" +
		    "            Vendor : "+glu.getClassVendor()   + "\n" +
		    "Native-Library     : GL4Java.GLUFunc impl.       \n" +
		    "            Version: "+glu.getNativeVersion() + "\n" +
		    "            Vendor : "+glu.getNativeVendor()  + "\n" +
      	            "-------------------------------------------------\n" +
		    "\n" ;

        String glVen = gl.glGetString(GLFunc.GL_VENDOR);
	String glRen = gl.glGetString(GLFunc.GL_RENDERER);
	String glVer = gl.glGetString(GLFunc.GL_VERSION);
	String glExt = gl.glGetString(GLFunc.GL_EXTENSIONS);
	String gluVer = glu.gluGetString(GLUFunc.GLU_VERSION);
	String gluExt = glu.gluGetString(GLUFunc.GLU_EXTENSIONS);

     String info2=      "OpenGL - Versions                              \n" +
      	                "-----------------------------------------------\n" +
	                "GL  VENDOR: "+glVen+"\n"+
			"GL  RENDERER: "+glRen+"\n"+
			"GL  VERSION: "+glVer+"\n"+
			"GL  EXTENSIONS: "+glExt+"\n"+
			"GLU VERSION: "+gluVer+"\n"+
			"GLU EXTENSIONS: "+gluExt+"\n"+"\n" ;
	
     String info3=      "OpenGL - Function Test ("+ 
     			GLFunc.GL_PROC_NAMES.length +" Functions)       \n" +
      	                "-----------------------------------------------\n";

     if(verbose)
     {
	 System.out.println(info1);
	 System.out.println(info2);
	 System.out.println(info3);
     }
	 
     String h;	
     String tmp;

     for(int i=0; i<GLFunc.GL_PROC_NAMES.length; i++)
     {
        h=GLFunc.GL_PROC_NAMES[i];
	if(h==null) break;

     	if(gljTestGLProc (h, verbose))
		tmp= "OK  : "+h+"\n";
	else
		tmp= "NOPE: "+h+"\n";
	    
	info3 += tmp;
     }

     return info1+"\n"+info2+"\n"+info3;
    }

    /**
     * function to show complete version info into an extra Frame
     *
     * Be sure that the native library must be loaded !
     */
    public final Frame gljShowVersions()
    {
	Frame f = new Frame("GL4Java Version");
	TextArea info= new TextArea(25, 80);
	info.setEditable(false);
	f.add(info);
	f.setSize(600, 400);

	f.pack();
	f.setVisible(true);

	String str = "null string";
	if( gljMakeCurrent(true) == false ) 
	{
		str="problem in use() method\n";
	} else {
		str=gljGetVersions(gljNativeDebug);
		if(str==null)
			str="could not get versions";
		System.out.println(str);
		gljFree();
	}
	info.append(str);

	f.addWindowListener
			   ( new WindowAdapter()
			      {
				public void windowClosing(WindowEvent e)
				{
				   // button window menu ... :-)
				   e.getWindow().dispose();
				}
			      }
			    );              

	return f;
    }

}