summaryrefslogtreecommitdiffstats
path: root/src/opengl/qglfunctions.cpp
blob: be8219a07fc26d31c10165e35b4467effce073fa (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
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights.  These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

#include "qglfunctions.h"
#include "qgl_p.h"

QT_BEGIN_NAMESPACE

/*!
    \class QGLFunctions
    \brief The QGLFunctions class provides cross-platform access to the OpenGL/ES 2.0 API.
    \since 4.8
    \ingroup painting-3D

    OpenGL/ES 2.0 defines a subset of the OpenGL specification that is
    common across many desktop and embedded OpenGL implementations.
    However, it can be difficult to use the functions from that subset
    because they need to be resolved manually on desktop systems.

    QGLFunctions provides a guaranteed API that is available on all
    OpenGL systems and takes care of function resolution on systems
    that need it.  The recommended way to use QGLFunctions is by
    direct inheritance:

    \code
    class MyGLWidget : public QGLWidget, protected QGLFunctions
    {
        Q_OBJECT
    public:
        MyGLWidget(QWidget *parent = 0) : QGLWidget(parent) {}

    protected:
        void initializeGL();
        void paintGL();
    };

    void MyGLWidget::initializeGL()
    {
        initializeGLFunctions();
    }
    \endcode

    The \c{paintGL()} function can then use any of the OpenGL/ES 2.0
    functions without explicit resolution, such as glActiveTexture()
    in the following example:

    \code
    void MyGLWidget::paintGL()
    {
        glActiveTexture(GL_TEXTURE1);
        glBindTexture(GL_TEXTURE_2D, textureId);
        ...
    }
    \endcode

    QGLFunctions can also be used directly for ad-hoc invocation
    of OpenGL/ES 2.0 functions on all platforms:

    \code
    QGLFunctions glFuncs(QGLContext::currentContext());
    glFuncs.glActiveTexture(GL_TEXTURE1);
    \endcode

    QGLFunctions provides wrappers for all OpenGL/ES 2.0 functions,
    except those like \c{glDrawArrays()}, \c{glViewport()}, and
    \c{glBindTexture()} that don't have portability issues.

    Including the header for QGLFunctions will also define all of
    the OpenGL/ES 2.0 macro constants that are not already defined by
    the system's OpenGL headers, such as \c{GL_TEXTURE1} above.

    The hasOpenGLFeature() and openGLFeatures() functions can be used
    to determine if the OpenGL implementation has a major OpenGL/ES 2.0
    feature.  For example, the following checks if non power of two
    textures are available:

    \code
    QGLFunctions funcs(QGLContext::currentContext());
    bool npot = funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures);
    \endcode
*/

/*!
    \enum QGLFunctions::OpenGLFeature
    This enum defines OpenGL/ES 2.0 features that may be optional
    on other platforms.

    \value Multitexture glActiveTexture() function is available.
    \value Shaders Shader functions are available.
    \value Buffers Vertex and index buffer functions are available.
    \value Framebuffers Framebuffer object functions are available.
    \value BlendColor glBlendColor() is available.
    \value BlendEquation glBlendEquation() is available.
    \value BlendEquationSeparate glBlendEquationSeparate() is available.
    \value BlendFuncSeparate glBlendFuncSeparate() is available.
    \value BlendSubtract Blend subtract mode is available.
    \value CompressedTextures Compressed texture functions are available.
    \value Multisample glSampleCoverage() function is available.
    \value StencilSeparate Separate stencil functions are available.
    \value NPOTTextures Non power of two textures are available.
*/

// Hidden private fields for additional extension data.
struct QGLFunctionsPrivateEx : public QGLFunctionsPrivate
{
    QGLFunctionsPrivateEx(const QGLContext *context = 0)
        : QGLFunctionsPrivate(context)
        , m_features(-1) {}

    int m_features;
};

#if QT_VERSION >= 0x040800
Q_GLOBAL_STATIC(QGLContextGroupResource<QGLFunctionsPrivateEx>, qt_gl_functions_resource)
#else
static void qt_gl_functions_free(void *data)
{
    delete reinterpret_cast<QGLFunctionsPrivateEx *>(data);
}

Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_gl_functions_resource, (qt_gl_functions_free))
#endif
static QGLFunctionsPrivateEx *qt_gl_functions(const QGLContext *context = 0)
{
    if (!context)
        context = QGLContext::currentContext();
    Q_ASSERT(context);
    QGLFunctionsPrivateEx *funcs =
        reinterpret_cast<QGLFunctionsPrivateEx *>
            (qt_gl_functions_resource()->value(context));
#if QT_VERSION < 0x040800
    if (!funcs) {
        funcs = new QGLFunctionsPrivateEx();
        qt_gl_functions_resource()->insert(context, funcs);
    }
#endif
    return funcs;
}

/*!
    Constructs a default function resolver.  The resolver cannot
    be used until initializeGLFunctions() is called to specify
    the context.

    \sa initializeGLFunctions()
*/
QGLFunctions::QGLFunctions()
    : d_ptr(0)
{
}

/*!
    Constructs a function resolver for \a context.  If \a context
    is null, then the resolver will be created for the current QGLContext.

    An object constructed in this way can only be used with \a context
    and other contexts that share with it.  Use initializeGLFunctions()
    to change the object's context association.

    \sa initializeGLFunctions()
*/
QGLFunctions::QGLFunctions(const QGLContext *context)
    : d_ptr(qt_gl_functions(context))
{
}

/*!
    \fn QGLFunctions::~QGLFunctions()

    Destroys this function resolver.
*/

static int qt_gl_resolve_features()
{
#if defined(QT_OPENGL_ES_2)
    return QGLFunctions::Multitexture |
           QGLFunctions::Shaders |
           QGLFunctions::Buffers |
           QGLFunctions::Framebuffers |
           QGLFunctions::BlendColor |
           QGLFunctions::BlendEquation |
           QGLFunctions::BlendEquationSeparate |
           QGLFunctions::BlendFuncSeparate |
           QGLFunctions::BlendSubtract |
           QGLFunctions::CompressedTextures |
           QGLFunctions::Multisample |
           QGLFunctions::StencilSeparate |
           QGLFunctions::NPOTTextures;
#elif defined(QT_OPENGL_ES)
    int features = QGLFunctions::Multitexture |
                   QGLFunctions::Buffers |
                   QGLFunctions::CompressedTextures |
                   QGLFunctions::Multisample;
    QGLExtensionMatcher extensions;
    if (extensions.match("GL_OES_framebuffer_object"))
        features |= QGLFunctions::Framebuffers;
    if (extensions.match("GL_OES_blend_equation_separate"))
        features |= QGLFunctions::BlendEquationSeparate;
    if (extensions.match("GL_OES_blend_func_separate"))
        features |= QGLFunctions::BlendFuncSeparate;
    if (extensions.match("GL_OES_blend_subtract"))
        features |= QGLFunctions::BlendSubtract;
    if (extensions.match("GL_OES_texture_npot"))
        features |= QGLFunctions::NPOTTextures;
    return features;
#else
    int features = 0;
    QGLFormat::OpenGLVersionFlags versions = QGLFormat::openGLVersionFlags();
    QGLExtensionMatcher extensions;

    // Recognize features by extension name.
    if (extensions.match("GL_ARB_multitexture"))
        features |= QGLFunctions::Multitexture;
    if (extensions.match("GL_ARB_shader_objects"))
        features |= QGLFunctions::Shaders;
    if (extensions.match("GL_EXT_framebuffer_object") ||
            extensions.match("GL_ARB_framebuffer_object"))
        features |= QGLFunctions::Framebuffers;
    if (extensions.match("GL_EXT_blend_color"))
        features |= QGLFunctions::BlendColor;
    if (extensions.match("GL_EXT_blend_equation_separate"))
        features |= QGLFunctions::BlendEquationSeparate;
    if (extensions.match("GL_EXT_blend_func_separate"))
        features |= QGLFunctions::BlendFuncSeparate;
    if (extensions.match("GL_EXT_blend_subtract"))
        features |= QGLFunctions::BlendSubtract;
    if (extensions.match("GL_ARB_texture_compression"))
        features |= QGLFunctions::CompressedTextures;
    if (extensions.match("GL_ARB_multisample"))
        features |= QGLFunctions::Multisample;
    if (extensions.match("GL_ARB_texture_non_power_of_two"))
        features |= QGLFunctions::NPOTTextures;

    // Recognize features by minimum OpenGL version.
    if (versions & QGLFormat::OpenGL_Version_1_2) {
        features |= QGLFunctions::BlendColor |
                    QGLFunctions::BlendEquation;
    }
    if (versions & QGLFormat::OpenGL_Version_1_3) {
        features |= QGLFunctions::Multitexture |
                    QGLFunctions::CompressedTextures |
                    QGLFunctions::Multisample;
    }
    if (versions & QGLFormat::OpenGL_Version_1_4)
        features |= QGLFunctions::BlendFuncSeparate;
    if (versions & QGLFormat::OpenGL_Version_1_5)
        features |= QGLFunctions::Buffers;
    if (versions & QGLFormat::OpenGL_Version_2_0) {
        features |= QGLFunctions::Shaders |
                    QGLFunctions::StencilSeparate |
                    QGLFunctions::BlendEquationSeparate |
                    QGLFunctions::NPOTTextures;
    }
    return features;
#endif
}

/*!
    Returns the set of features that are present on this system's
    OpenGL implementation.

    It is assumed that the QGLContext associated with this function
    resolver is current.

    \sa hasOpenGLFeature()
*/
QGLFunctions::OpenGLFeatures QGLFunctions::openGLFeatures() const
{
    QGLFunctionsPrivateEx *d = static_cast<QGLFunctionsPrivateEx *>(d_ptr);
    if (!d)
        return 0;
    if (d->m_features == -1)
        d->m_features = qt_gl_resolve_features();
    return QGLFunctions::OpenGLFeatures(d->m_features);
}

/*!
    Returns true if \a feature is present on this system's OpenGL
    implementation; false otherwise.

    It is assumed that the QGLContext associated with this function
    resolver is current.

    \sa openGLFeatures()
*/
bool QGLFunctions::hasOpenGLFeature(QGLFunctions::OpenGLFeature feature) const
{
    QGLFunctionsPrivateEx *d = static_cast<QGLFunctionsPrivateEx *>(d_ptr);
    if (!d)
        return false;
    if (d->m_features == -1)
        d->m_features = qt_gl_resolve_features();
    return (d->m_features & int(feature)) != 0;
}

/*!
    Initializes GL function resolution for \a context.  If \a context
    is null, then the current QGLContext will be used.

    After calling this function, the QGLFunctions object can only be
    used with \a context and other contexts that share with it.
    Call initializeGLFunctions() again to change the object's context
    association.
*/
void QGLFunctions::initializeGLFunctions(const QGLContext *context)
{
    d_ptr = qt_gl_functions(context);
}

/*!
    \fn void QGLFunctions::glActiveTexture(GLenum texture)

    Convenience function that calls glActiveTexture(\a texture).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glActiveTexture.xml}{glActiveTexture()}.
*/

/*!
    \fn void QGLFunctions::glAttachShader(GLuint program, GLuint shader)

    Convenience function that calls glAttachShader(\a program, \a shader).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glAttachShader.xml}{glAttachShader()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glBindAttribLocation(GLuint program, GLuint index, const char* name)

    Convenience function that calls glBindAttribLocation(\a program, \a index, \a name).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glBindAttribLocation.xml}{glBindAttribLocation()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glBindBuffer(GLenum target, GLuint buffer)

    Convenience function that calls glBindBuffer(\a target, \a buffer).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glBindBuffer.xml}{glBindBuffer()}.
*/

/*!
    \fn void QGLFunctions::glBindFramebuffer(GLenum target, GLuint framebuffer)

    Convenience function that calls glBindFramebuffer(\a target, \a framebuffer).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glBindFramebuffer.xml}{glBindFramebuffer()}.
*/

/*!
    \fn void QGLFunctions::glBindRenderbuffer(GLenum target, GLuint renderbuffer)

    Convenience function that calls glBindRenderbuffer(\a target, \a renderbuffer).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glBindRenderbuffer.xml}{glBindRenderbuffer()}.
*/

/*!
    \fn void QGLFunctions::glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)

    Convenience function that calls glBlendColor(\a red, \a green, \a blue, \a alpha).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendColor.xml}{glBlendColor()}.
*/

/*!
    \fn void QGLFunctions::glBlendEquation(GLenum mode)

    Convenience function that calls glBlendEquation(\a mode).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendEquation.xml}{glBlendEquation()}.
*/

/*!
    \fn void QGLFunctions::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)

    Convenience function that calls glBlendEquationSeparate(\a modeRGB, \a modeAlpha).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendEquationSeparate.xml}{glBlendEquationSeparate()}.
*/

/*!
    \fn void QGLFunctions::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)

    Convenience function that calls glBlendFuncSeparate(\a srcRGB, \a dstRGB, \a srcAlpha, \a dstAlpha).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendFuncSeparate.xml}{glBlendFuncSeparate()}.
*/

/*!
    \fn void QGLFunctions::glBufferData(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage)

    Convenience function that calls glBufferData(\a target, \a size, \a data, \a usage).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glBufferData.xml}{glBufferData()}.
*/

/*!
    \fn void QGLFunctions::glBufferSubData(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data)

    Convenience function that calls glBufferSubData(\a target, \a offset, \a size, \a data).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glBufferSubData.xml}{glBufferSubData()}.
*/

/*!
    \fn GLenum QGLFunctions::glCheckFramebufferStatus(GLenum target)

    Convenience function that calls glCheckFramebufferStatus(\a target).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glCheckFramebufferStatus.xml}{glCheckFramebufferStatus()}.
*/

/*!
    \fn void QGLFunctions::glClearDepthf(GLclampf depth)

    Convenience function that calls glClearDepth(\a depth) on
    desktop OpenGL systems and glClearDepthf(\a depth) on
    embedded OpenGL/ES systems.

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glClearDepthf.xml}{glClearDepthf()}.
*/

/*!
    \fn void QGLFunctions::glCompileShader(GLuint shader)

    Convenience function that calls glCompileShader(\a shader).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glCompileShader.xml}{glCompileShader()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)

    Convenience function that calls glCompressedTexImage2D(\a target, \a level, \a internalformat, \a width, \a height, \a border, \a imageSize, \a data).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glCompressedTexImage2D.xml}{glCompressedTexImage2D()}.
*/

/*!
    \fn void QGLFunctions::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)

    Convenience function that calls glCompressedTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a width, \a height, \a format, \a imageSize, \a data).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glCompressedTexSubImage2D.xml}{glCompressedTexSubImage2D()}.
*/

/*!
    \fn GLuint QGLFunctions::glCreateProgram()

    Convenience function that calls glCreateProgram().

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glCreateProgram.xml}{glCreateProgram()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn GLuint QGLFunctions::glCreateShader(GLenum type)

    Convenience function that calls glCreateShader(\a type).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glCreateShader.xml}{glCreateShader()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glDeleteBuffers(GLsizei n, const GLuint* buffers)

    Convenience function that calls glDeleteBuffers(\a n, \a buffers).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteBuffers.xml}{glDeleteBuffers()}.
*/

/*!
    \fn void QGLFunctions::glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)

    Convenience function that calls glDeleteFramebuffers(\a n, \a framebuffers).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteFramebuffers.xml}{glDeleteFramebuffers()}.
*/

/*!
    \fn void QGLFunctions::glDeleteProgram(GLuint program)

    Convenience function that calls glDeleteProgram(\a program).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteProgram.xml}{glDeleteProgram()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)

    Convenience function that calls glDeleteRenderbuffers(\a n, \a renderbuffers).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteRenderbuffers.xml}{glDeleteRenderbuffers()}.
*/

/*!
    \fn void QGLFunctions::glDeleteShader(GLuint shader)

    Convenience function that calls glDeleteShader(\a shader).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteShader.xml}{glDeleteShader()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glDepthRangef(GLclampf zNear, GLclampf zFar)

    Convenience function that calls glDepthRange(\a zNear, \a zFar) on
    desktop OpenGL systems and glDepthRangef(\a zNear, \a zFar) on
    embedded OpenGL/ES systems.

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glDepthRangef.xml}{glDepthRangef()}.
*/

/*!
    \fn void QGLFunctions::glDetachShader(GLuint program, GLuint shader)

    Convenience function that calls glDetachShader(\a program, \a shader).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glDetachShader.xml}{glDetachShader()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glDisableVertexAttribArray(GLuint index)

    Convenience function that calls glDisableVertexAttribArray(\a index).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glDisableVertexAttribArray.xml}{glDisableVertexAttribArray()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glEnableVertexAttribArray(GLuint index)

    Convenience function that calls glEnableVertexAttribArray(\a index).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glEnableVertexAttribArray.xml}{glEnableVertexAttribArray()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)

    Convenience function that calls glFramebufferRenderbuffer(\a target, \a attachment, \a renderbuffertarget, \a renderbuffer).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glFramebufferRenderbuffer.xml}{glFramebufferRenderbuffer()}.
*/

/*!
    \fn void QGLFunctions::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)

    Convenience function that calls glFramebufferTexture2D(\a target, \a attachment, \a textarget, \a texture, \a level).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glFramebufferTexture2D.xml}{glFramebufferTexture2D()}.
*/

/*!
    \fn void QGLFunctions::glGenBuffers(GLsizei n, GLuint* buffers)

    Convenience function that calls glGenBuffers(\a n, \a buffers).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGenBuffers.xml}{glGenBuffers()}.
*/

/*!
    \fn void QGLFunctions::glGenerateMipmap(GLenum target)

    Convenience function that calls glGenerateMipmap(\a target).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGenerateMipmap.xml}{glGenerateMipmap()}.
*/

/*!
    \fn void QGLFunctions::glGenFramebuffers(GLsizei n, GLuint* framebuffers)

    Convenience function that calls glGenFramebuffers(\a n, \a framebuffers).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGenFramebuffers.xml}{glGenFramebuffers()}.
*/

/*!
    \fn void QGLFunctions::glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)

    Convenience function that calls glGenRenderbuffers(\a n, \a renderbuffers).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGenRenderbuffers.xml}{glGenRenderbuffers()}.
*/

/*!
    \fn void QGLFunctions::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)

    Convenience function that calls glGetActiveAttrib(\a program, \a index, \a bufsize, \a length, \a size, \a type, \a name).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetActiveAttrib.xml}{glGetActiveAttrib()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)

    Convenience function that calls glGetActiveUniform(\a program, \a index, \a bufsize, \a length, \a size, \a type, \a name).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetActiveUniform.xml}{glGetActiveUniform()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)

    Convenience function that calls glGetAttachedShaders(\a program, \a maxcount, \a count, \a shaders).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetAttachedShaders.xml}{glGetAttachedShaders()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn int QGLFunctions::glGetAttribLocation(GLuint program, const char* name)

    Convenience function that calls glGetAttribLocation(\a program, \a name).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetAttribLocation.xml}{glGetAttribLocation()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)

    Convenience function that calls glGetBufferParameteriv(\a target, \a pname, \a params).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetBufferParameteriv.xml}{glGetBufferParameteriv()}.
*/

/*!
    \fn void QGLFunctions::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)

    Convenience function that calls glGetFramebufferAttachmentParameteriv(\a target, \a attachment, \a pname, \a params).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetFramebufferAttachmentParameteriv.xml}{glGetFramebufferAttachmentParameteriv()}.
*/

/*!
    \fn void QGLFunctions::glGetProgramiv(GLuint program, GLenum pname, GLint* params)

    Convenience function that calls glGetProgramiv(\a program, \a pname, \a params).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetProgramiv.xml}{glGetProgramiv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)

    Convenience function that calls glGetProgramInfoLog(\a program, \a bufsize, \a length, \a infolog).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetProgramInfoLog.xml}{glGetProgramInfoLog()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)

    Convenience function that calls glGetRenderbufferParameteriv(\a target, \a pname, \a params).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetRenderbufferParameteriv.xml}{glGetRenderbufferParameteriv()}.
*/

/*!
    \fn void QGLFunctions::glGetShaderiv(GLuint shader, GLenum pname, GLint* params)

    Convenience function that calls glGetShaderiv(\a shader, \a pname, \a params).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderiv.xml}{glGetShaderiv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)

    Convenience function that calls glGetShaderInfoLog(\a shader, \a bufsize, \a length, \a infolog).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderInfoLog.xml}{glGetShaderInfoLog()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)

    Convenience function that calls glGetShaderPrecisionFormat(\a shadertype, \a precisiontype, \a range, \a precision).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderPrecisionFormat.xml}{glGetShaderPrecisionFormat()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)

    Convenience function that calls glGetShaderSource(\a shader, \a bufsize, \a length, \a source).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderSource.xml}{glGetShaderSource()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glGetUniformfv(GLuint program, GLint location, GLfloat* params)

    Convenience function that calls glGetUniformfv(\a program, \a location, \a params).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetUniformfv.xml}{glGetUniformfv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glGetUniformiv(GLuint program, GLint location, GLint* params)

    Convenience function that calls glGetUniformiv(\a program, \a location, \a params).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetUniformiv.xml}{glGetUniformiv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn int QGLFunctions::glGetUniformLocation(GLuint program, const char* name)

    Convenience function that calls glGetUniformLocation(\a program, \a name).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetUniformLocation.xml}{glGetUniformLocation()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)

    Convenience function that calls glGetVertexAttribfv(\a index, \a pname, \a params).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetVertexAttribfv.xml}{glGetVertexAttribfv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)

    Convenience function that calls glGetVertexAttribiv(\a index, \a pname, \a params).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetVertexAttribiv.xml}{glGetVertexAttribiv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)

    Convenience function that calls glGetVertexAttribPointerv(\a index, \a pname, \a pointer).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glGetVertexAttribPointerv.xml}{glGetVertexAttribPointerv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn GLboolean QGLFunctions::glIsBuffer(GLuint buffer)

    Convenience function that calls glIsBuffer(\a buffer).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glIsBuffer.xml}{glIsBuffer()}.
*/

/*!
    \fn GLboolean QGLFunctions::glIsFramebuffer(GLuint framebuffer)

    Convenience function that calls glIsFramebuffer(\a framebuffer).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glIsFramebuffer.xml}{glIsFramebuffer()}.
*/

/*!
    \fn GLboolean QGLFunctions::glIsProgram(GLuint program)

    Convenience function that calls glIsProgram(\a program).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glIsProgram.xml}{glIsProgram()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn GLboolean QGLFunctions::glIsRenderbuffer(GLuint renderbuffer)

    Convenience function that calls glIsRenderbuffer(\a renderbuffer).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glIsRenderbuffer.xml}{glIsRenderbuffer()}.
*/

/*!
    \fn GLboolean QGLFunctions::glIsShader(GLuint shader)

    Convenience function that calls glIsShader(\a shader).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glIsShader.xml}{glIsShader()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glLinkProgram(GLuint program)

    Convenience function that calls glLinkProgram(\a program).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glLinkProgram.xml}{glLinkProgram()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glReleaseShaderCompiler()

    Convenience function that calls glReleaseShaderCompiler().

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glReleaseShaderCompiler.xml}{glReleaseShaderCompiler()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)

    Convenience function that calls glRenderbufferStorage(\a target, \a internalformat, \a width, \a height).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glRenderbufferStorage.xml}{glRenderbufferStorage()}.
*/

/*!
    \fn void QGLFunctions::glSampleCoverage(GLclampf value, GLboolean invert)

    Convenience function that calls glSampleCoverage(\a value, \a invert).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glSampleCoverage.xml}{glSampleCoverage()}.
*/

/*!
    \fn void QGLFunctions::glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length)

    Convenience function that calls glShaderBinary(\a n, \a shaders, \a binaryformat, \a binary, \a length).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glShaderBinary.xml}{glShaderBinary()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)

    Convenience function that calls glShaderSource(\a shader, \a count, \a string, \a length).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glShaderSource.xml}{glShaderSource()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)

    Convenience function that calls glStencilFuncSeparate(\a face, \a func, \a ref, \a mask).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilFuncSeparate.xml}{glStencilFuncSeparate()}.
*/

/*!
    \fn void QGLFunctions::glStencilMaskSeparate(GLenum face, GLuint mask)

    Convenience function that calls glStencilMaskSeparate(\a face, \a mask).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilMaskSeparate.xml}{glStencilMaskSeparate()}.
*/

/*!
    \fn void QGLFunctions::glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)

    Convenience function that calls glStencilOpSeparate(\a face, \a fail, \a zfail, \a zpass).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilOpSeparate.xml}{glStencilOpSeparate()}.
*/

/*!
    \fn void QGLFunctions::glUniform1f(GLint location, GLfloat x)

    Convenience function that calls glUniform1f(\a location, \a x).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1f.xml}{glUniform1f()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniform1fv(GLint location, GLsizei count, const GLfloat* v)

    Convenience function that calls glUniform1fv(\a location, \a count, \a v).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1fv.xml}{glUniform1fv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniform1i(GLint location, GLint x)

    Convenience function that calls glUniform1i(\a location, \a x).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1i.xml}{glUniform1i()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniform1iv(GLint location, GLsizei count, const GLint* v)

    Convenience function that calls glUniform1iv(\a location, \a count, \a v).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1iv.xml}{glUniform1iv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniform2f(GLint location, GLfloat x, GLfloat y)

    Convenience function that calls glUniform2f(\a location, \a x, \a y).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2f.xml}{glUniform2f()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniform2fv(GLint location, GLsizei count, const GLfloat* v)

    Convenience function that calls glUniform2fv(\a location, \a count, \a v).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2fv.xml}{glUniform2fv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniform2i(GLint location, GLint x, GLint y)

    Convenience function that calls glUniform2i(\a location, \a x, \a y).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2i.xml}{glUniform2i()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniform2iv(GLint location, GLsizei count, const GLint* v)

    Convenience function that calls glUniform2iv(\a location, \a count, \a v).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2iv.xml}{glUniform2iv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)

    Convenience function that calls glUniform3f(\a location, \a x, \a y, \a z).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3f.xml}{glUniform3f()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniform3fv(GLint location, GLsizei count, const GLfloat* v)

    Convenience function that calls glUniform3fv(\a location, \a count, \a v).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3fv.xml}{glUniform3fv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniform3i(GLint location, GLint x, GLint y, GLint z)

    Convenience function that calls glUniform3i(\a location, \a x, \a y, \a z).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3i.xml}{glUniform3i()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniform3iv(GLint location, GLsizei count, const GLint* v)

    Convenience function that calls glUniform3iv(\a location, \a count, \a v).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3iv.xml}{glUniform3iv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)

    Convenience function that calls glUniform4f(\a location, \a x, \a y, \a z, \a w).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4f.xml}{glUniform4f()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniform4fv(GLint location, GLsizei count, const GLfloat* v)

    Convenience function that calls glUniform4fv(\a location, \a count, \a v).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4fv.xml}{glUniform4fv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)

    Convenience function that calls glUniform4i(\a location, \a x, \a y, \a z, \a w).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4i.xml}{glUniform4i()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniform4iv(GLint location, GLsizei count, const GLint* v)

    Convenience function that calls glUniform4iv(\a location, \a count, \a v).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4iv.xml}{glUniform4iv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)

    Convenience function that calls glUniformMatrix2fv(\a location, \a count, \a transpose, \a value).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniformMatrix2fv.xml}{glUniformMatrix2fv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)

    Convenience function that calls glUniformMatrix3fv(\a location, \a count, \a transpose, \a value).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniformMatrix3fv.xml}{glUniformMatrix3fv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)

    Convenience function that calls glUniformMatrix4fv(\a location, \a count, \a transpose, \a value).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUniformMatrix4fv.xml}{glUniformMatrix4fv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glUseProgram(GLuint program)

    Convenience function that calls glUseProgram(\a program).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glUseProgram.xml}{glUseProgram()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glValidateProgram(GLuint program)

    Convenience function that calls glValidateProgram(\a program).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glValidateProgram.xml}{glValidateProgram()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glVertexAttrib1f(GLuint indx, GLfloat x)

    Convenience function that calls glVertexAttrib1f(\a indx, \a x).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib1f.xml}{glVertexAttrib1f()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glVertexAttrib1fv(GLuint indx, const GLfloat* values)

    Convenience function that calls glVertexAttrib1fv(\a indx, \a values).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib1fv.xml}{glVertexAttrib1fv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)

    Convenience function that calls glVertexAttrib2f(\a indx, \a x, \a y).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib2f.xml}{glVertexAttrib2f()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glVertexAttrib2fv(GLuint indx, const GLfloat* values)

    Convenience function that calls glVertexAttrib2fv(\a indx, \a values).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib2fv.xml}{glVertexAttrib2fv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)

    Convenience function that calls glVertexAttrib3f(\a indx, \a x, \a y, \a z).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib3f.xml}{glVertexAttrib3f()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glVertexAttrib3fv(GLuint indx, const GLfloat* values)

    Convenience function that calls glVertexAttrib3fv(\a indx, \a values).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib3fv.xml}{glVertexAttrib3fv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)

    Convenience function that calls glVertexAttrib4f(\a indx, \a x, \a y, \a z, \a w).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib4f.xml}{glVertexAttrib4f()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glVertexAttrib4fv(GLuint indx, const GLfloat* values)

    Convenience function that calls glVertexAttrib4fv(\a indx, \a values).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib4fv.xml}{glVertexAttrib4fv()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

/*!
    \fn void QGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)

    Convenience function that calls glVertexAttribPointer(\a indx, \a size, \a type, \a normalized, \a stride, \a ptr).

    For more information, see the OpenGL/ES 2.0 documentation for
    \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttribPointer.xml}{glVertexAttribPointer()}.

    This convenience function will do nothing on OpenGL/ES 1.x systems.
*/

#ifndef QT_OPENGL_ES_2

static void qglfResolveActiveTexture(GLenum texture)
{
    typedef void (QGLF_APIENTRYP type_glActiveTexture)(GLenum texture);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->activeTexture = (type_glActiveTexture)
        context->getProcAddress(QLatin1String("glActiveTexture"));
    if (!funcs->activeTexture) {
        funcs->activeTexture = (type_glActiveTexture)
            context->getProcAddress(QLatin1String("glActiveTextureARB"));
    }

    if (funcs->activeTexture)
        funcs->activeTexture(texture);
    else
        funcs->activeTexture = qglfResolveActiveTexture;
}

static void qglfResolveAttachShader(GLuint program, GLuint shader)
{
    typedef void (QGLF_APIENTRYP type_glAttachShader)(GLuint program, GLuint shader);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->attachShader = (type_glAttachShader)
        context->getProcAddress(QLatin1String("glAttachShader"));
    if (!funcs->attachShader) {
        funcs->attachShader = (type_glAttachShader)
            context->getProcAddress(QLatin1String("glAttachObjectARB"));
    }

    if (funcs->attachShader)
        funcs->attachShader(program, shader);
    else
        funcs->attachShader = qglfResolveAttachShader;
}

static void qglfResolveBindAttribLocation(GLuint program, GLuint index, const char* name)
{
    typedef void (QGLF_APIENTRYP type_glBindAttribLocation)(GLuint program, GLuint index, const char* name);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->bindAttribLocation = (type_glBindAttribLocation)
        context->getProcAddress(QLatin1String("glBindAttribLocation"));
    if (!funcs->bindAttribLocation) {
        funcs->bindAttribLocation = (type_glBindAttribLocation)
            context->getProcAddress(QLatin1String("glBindAttribLocationARB"));
    }

    if (funcs->bindAttribLocation)
        funcs->bindAttribLocation(program, index, name);
    else
        funcs->bindAttribLocation = qglfResolveBindAttribLocation;
}

static void qglfResolveBindBuffer(GLenum target, GLuint buffer)
{
    typedef void (QGLF_APIENTRYP type_glBindBuffer)(GLenum target, GLuint buffer);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->bindBuffer = (type_glBindBuffer)
        context->getProcAddress(QLatin1String("glBindBuffer"));
#ifdef QT_OPENGL_ES
    if (!funcs->bindBuffer) {
        funcs->bindBuffer = (type_glBindBuffer)
            context->getProcAddress(QLatin1String("glBindBufferOES"));
    }
#endif
    if (!funcs->bindBuffer) {
        funcs->bindBuffer = (type_glBindBuffer)
            context->getProcAddress(QLatin1String("glBindBufferEXT"));
    }
    if (!funcs->bindBuffer) {
        funcs->bindBuffer = (type_glBindBuffer)
            context->getProcAddress(QLatin1String("glBindBufferARB"));
    }

    if (funcs->bindBuffer)
        funcs->bindBuffer(target, buffer);
    else
        funcs->bindBuffer = qglfResolveBindBuffer;
}

static void qglfResolveBindFramebuffer(GLenum target, GLuint framebuffer)
{
    typedef void (QGLF_APIENTRYP type_glBindFramebuffer)(GLenum target, GLuint framebuffer);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->bindFramebuffer = (type_glBindFramebuffer)
        context->getProcAddress(QLatin1String("glBindFramebuffer"));
#ifdef QT_OPENGL_ES
    if (!funcs->bindFramebuffer) {
        funcs->bindFramebuffer = (type_glBindFramebuffer)
            context->getProcAddress(QLatin1String("glBindFramebufferOES"));
    }
#endif
    if (!funcs->bindFramebuffer) {
        funcs->bindFramebuffer = (type_glBindFramebuffer)
            context->getProcAddress(QLatin1String("glBindFramebufferEXT"));
    }
    if (!funcs->bindFramebuffer) {
        funcs->bindFramebuffer = (type_glBindFramebuffer)
            context->getProcAddress(QLatin1String("glBindFramebufferARB"));
    }

    if (funcs->bindFramebuffer)
        funcs->bindFramebuffer(target, framebuffer);
    else
        funcs->bindFramebuffer = qglfResolveBindFramebuffer;
}

static void qglfResolveBindRenderbuffer(GLenum target, GLuint renderbuffer)
{
    typedef void (QGLF_APIENTRYP type_glBindRenderbuffer)(GLenum target, GLuint renderbuffer);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->bindRenderbuffer = (type_glBindRenderbuffer)
        context->getProcAddress(QLatin1String("glBindRenderbuffer"));
#ifdef QT_OPENGL_ES
    if (!funcs->bindRenderbuffer) {
        funcs->bindRenderbuffer = (type_glBindRenderbuffer)
            context->getProcAddress(QLatin1String("glBindRenderbufferOES"));
    }
#endif
    if (!funcs->bindRenderbuffer) {
        funcs->bindRenderbuffer = (type_glBindRenderbuffer)
            context->getProcAddress(QLatin1String("glBindRenderbufferEXT"));
    }
    if (!funcs->bindRenderbuffer) {
        funcs->bindRenderbuffer = (type_glBindRenderbuffer)
            context->getProcAddress(QLatin1String("glBindRenderbufferARB"));
    }

    if (funcs->bindRenderbuffer)
        funcs->bindRenderbuffer(target, renderbuffer);
    else
        funcs->bindRenderbuffer = qglfResolveBindRenderbuffer;
}

static void qglfResolveBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{
    typedef void (QGLF_APIENTRYP type_glBlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->blendColor = (type_glBlendColor)
        context->getProcAddress(QLatin1String("glBlendColor"));
#ifdef QT_OPENGL_ES
    if (!funcs->blendColor) {
        funcs->blendColor = (type_glBlendColor)
            context->getProcAddress(QLatin1String("glBlendColorOES"));
    }
#endif
    if (!funcs->blendColor) {
        funcs->blendColor = (type_glBlendColor)
            context->getProcAddress(QLatin1String("glBlendColorEXT"));
    }
    if (!funcs->blendColor) {
        funcs->blendColor = (type_glBlendColor)
            context->getProcAddress(QLatin1String("glBlendColorARB"));
    }

    if (funcs->blendColor)
        funcs->blendColor(red, green, blue, alpha);
    else
        funcs->blendColor = qglfResolveBlendColor;
}

static void qglfResolveBlendEquation(GLenum mode)
{
    typedef void (QGLF_APIENTRYP type_glBlendEquation)(GLenum mode);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->blendEquation = (type_glBlendEquation)
        context->getProcAddress(QLatin1String("glBlendEquation"));
#ifdef QT_OPENGL_ES
    if (!funcs->blendEquation) {
        funcs->blendEquation = (type_glBlendEquation)
            context->getProcAddress(QLatin1String("glBlendEquationOES"));
    }
#endif
    if (!funcs->blendEquation) {
        funcs->blendEquation = (type_glBlendEquation)
            context->getProcAddress(QLatin1String("glBlendEquationEXT"));
    }
    if (!funcs->blendEquation) {
        funcs->blendEquation = (type_glBlendEquation)
            context->getProcAddress(QLatin1String("glBlendEquationARB"));
    }

    if (funcs->blendEquation)
        funcs->blendEquation(mode);
    else
        funcs->blendEquation = qglfResolveBlendEquation;
}

static void qglfResolveBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
{
    typedef void (QGLF_APIENTRYP type_glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->blendEquationSeparate = (type_glBlendEquationSeparate)
        context->getProcAddress(QLatin1String("glBlendEquationSeparate"));
#ifdef QT_OPENGL_ES
    if (!funcs->blendEquationSeparate) {
        funcs->blendEquationSeparate = (type_glBlendEquationSeparate)
            context->getProcAddress(QLatin1String("glBlendEquationSeparateOES"));
    }
#endif
    if (!funcs->blendEquationSeparate) {
        funcs->blendEquationSeparate = (type_glBlendEquationSeparate)
            context->getProcAddress(QLatin1String("glBlendEquationSeparateEXT"));
    }
    if (!funcs->blendEquationSeparate) {
        funcs->blendEquationSeparate = (type_glBlendEquationSeparate)
            context->getProcAddress(QLatin1String("glBlendEquationSeparateARB"));
    }

    if (funcs->blendEquationSeparate)
        funcs->blendEquationSeparate(modeRGB, modeAlpha);
    else
        funcs->blendEquationSeparate = qglfResolveBlendEquationSeparate;
}

static void qglfResolveBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
{
    typedef void (QGLF_APIENTRYP type_glBlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->blendFuncSeparate = (type_glBlendFuncSeparate)
        context->getProcAddress(QLatin1String("glBlendFuncSeparate"));
#ifdef QT_OPENGL_ES
    if (!funcs->blendFuncSeparate) {
        funcs->blendFuncSeparate = (type_glBlendFuncSeparate)
            context->getProcAddress(QLatin1String("glBlendFuncSeparateOES"));
    }
#endif
    if (!funcs->blendFuncSeparate) {
        funcs->blendFuncSeparate = (type_glBlendFuncSeparate)
            context->getProcAddress(QLatin1String("glBlendFuncSeparateEXT"));
    }
    if (!funcs->blendFuncSeparate) {
        funcs->blendFuncSeparate = (type_glBlendFuncSeparate)
            context->getProcAddress(QLatin1String("glBlendFuncSeparateARB"));
    }

    if (funcs->blendFuncSeparate)
        funcs->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
    else
        funcs->blendFuncSeparate = qglfResolveBlendFuncSeparate;
}

static void qglfResolveBufferData(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage)
{
    typedef void (QGLF_APIENTRYP type_glBufferData)(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->bufferData = (type_glBufferData)
        context->getProcAddress(QLatin1String("glBufferData"));
#ifdef QT_OPENGL_ES
    if (!funcs->bufferData) {
        funcs->bufferData = (type_glBufferData)
            context->getProcAddress(QLatin1String("glBufferDataOES"));
    }
#endif
    if (!funcs->bufferData) {
        funcs->bufferData = (type_glBufferData)
            context->getProcAddress(QLatin1String("glBufferDataEXT"));
    }
    if (!funcs->bufferData) {
        funcs->bufferData = (type_glBufferData)
            context->getProcAddress(QLatin1String("glBufferDataARB"));
    }

    if (funcs->bufferData)
        funcs->bufferData(target, size, data, usage);
    else
        funcs->bufferData = qglfResolveBufferData;
}

static void qglfResolveBufferSubData(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data)
{
    typedef void (QGLF_APIENTRYP type_glBufferSubData)(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->bufferSubData = (type_glBufferSubData)
        context->getProcAddress(QLatin1String("glBufferSubData"));
#ifdef QT_OPENGL_ES
    if (!funcs->bufferSubData) {
        funcs->bufferSubData = (type_glBufferSubData)
            context->getProcAddress(QLatin1String("glBufferSubDataOES"));
    }
#endif
    if (!funcs->bufferSubData) {
        funcs->bufferSubData = (type_glBufferSubData)
            context->getProcAddress(QLatin1String("glBufferSubDataEXT"));
    }
    if (!funcs->bufferSubData) {
        funcs->bufferSubData = (type_glBufferSubData)
            context->getProcAddress(QLatin1String("glBufferSubDataARB"));
    }

    if (funcs->bufferSubData)
        funcs->bufferSubData(target, offset, size, data);
    else
        funcs->bufferSubData = qglfResolveBufferSubData;
}

static GLenum qglfResolveCheckFramebufferStatus(GLenum target)
{
    typedef GLenum (QGLF_APIENTRYP type_glCheckFramebufferStatus)(GLenum target);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->checkFramebufferStatus = (type_glCheckFramebufferStatus)
        context->getProcAddress(QLatin1String("glCheckFramebufferStatus"));
#ifdef QT_OPENGL_ES
    if (!funcs->checkFramebufferStatus) {
        funcs->checkFramebufferStatus = (type_glCheckFramebufferStatus)
            context->getProcAddress(QLatin1String("glCheckFramebufferStatusOES"));
    }
#endif
    if (!funcs->checkFramebufferStatus) {
        funcs->checkFramebufferStatus = (type_glCheckFramebufferStatus)
            context->getProcAddress(QLatin1String("glCheckFramebufferStatusEXT"));
    }
    if (!funcs->checkFramebufferStatus) {
        funcs->checkFramebufferStatus = (type_glCheckFramebufferStatus)
            context->getProcAddress(QLatin1String("glCheckFramebufferStatusARB"));
    }

    if (funcs->checkFramebufferStatus)
        return funcs->checkFramebufferStatus(target);
    funcs->checkFramebufferStatus = qglfResolveCheckFramebufferStatus;
    return GLenum(0);
}

static void qglfResolveCompileShader(GLuint shader)
{
    typedef void (QGLF_APIENTRYP type_glCompileShader)(GLuint shader);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->compileShader = (type_glCompileShader)
        context->getProcAddress(QLatin1String("glCompileShader"));
    if (!funcs->compileShader) {
        funcs->compileShader = (type_glCompileShader)
            context->getProcAddress(QLatin1String("glCompileShader"));
    }

    if (funcs->compileShader)
        funcs->compileShader(shader);
    else
        funcs->compileShader = qglfResolveCompileShader;
}

static void qglfResolveCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
{
    typedef void (QGLF_APIENTRYP type_glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->compressedTexImage2D = (type_glCompressedTexImage2D)
        context->getProcAddress(QLatin1String("glCompressedTexImage2D"));
#ifdef QT_OPENGL_ES
    if (!funcs->compressedTexImage2D) {
        funcs->compressedTexImage2D = (type_glCompressedTexImage2D)
            context->getProcAddress(QLatin1String("glCompressedTexImage2DOES"));
    }
#endif
    if (!funcs->compressedTexImage2D) {
        funcs->compressedTexImage2D = (type_glCompressedTexImage2D)
            context->getProcAddress(QLatin1String("glCompressedTexImage2DEXT"));
    }
    if (!funcs->compressedTexImage2D) {
        funcs->compressedTexImage2D = (type_glCompressedTexImage2D)
            context->getProcAddress(QLatin1String("glCompressedTexImage2DARB"));
    }

    if (funcs->compressedTexImage2D)
        funcs->compressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
    else
        funcs->compressedTexImage2D = qglfResolveCompressedTexImage2D;
}

static void qglfResolveCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
{
    typedef void (QGLF_APIENTRYP type_glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->compressedTexSubImage2D = (type_glCompressedTexSubImage2D)
        context->getProcAddress(QLatin1String("glCompressedTexSubImage2D"));
#ifdef QT_OPENGL_ES
    if (!funcs->compressedTexSubImage2D) {
        funcs->compressedTexSubImage2D = (type_glCompressedTexSubImage2D)
            context->getProcAddress(QLatin1String("glCompressedTexSubImage2DOES"));
    }
#endif
    if (!funcs->compressedTexSubImage2D) {
        funcs->compressedTexSubImage2D = (type_glCompressedTexSubImage2D)
            context->getProcAddress(QLatin1String("glCompressedTexSubImage2DEXT"));
    }
    if (!funcs->compressedTexSubImage2D) {
        funcs->compressedTexSubImage2D = (type_glCompressedTexSubImage2D)
            context->getProcAddress(QLatin1String("glCompressedTexSubImage2DARB"));
    }

    if (funcs->compressedTexSubImage2D)
        funcs->compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
    else
        funcs->compressedTexSubImage2D = qglfResolveCompressedTexSubImage2D;
}

static GLuint qglfResolveCreateProgram()
{
    typedef GLuint (QGLF_APIENTRYP type_glCreateProgram)();

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->createProgram = (type_glCreateProgram)
        context->getProcAddress(QLatin1String("glCreateProgram"));
    if (!funcs->createProgram) {
        funcs->createProgram = (type_glCreateProgram)
            context->getProcAddress(QLatin1String("glCreateProgramObjectARB"));
    }

    if (funcs->createProgram)
        return funcs->createProgram();
    funcs->createProgram = qglfResolveCreateProgram;
    return GLuint(0);
}

static GLuint qglfResolveCreateShader(GLenum type)
{
    typedef GLuint (QGLF_APIENTRYP type_glCreateShader)(GLenum type);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->createShader = (type_glCreateShader)
        context->getProcAddress(QLatin1String("glCreateShader"));
    if (!funcs->createShader) {
        funcs->createShader = (type_glCreateShader)
            context->getProcAddress(QLatin1String("glCreateShaderObjectARB"));
    }

    if (funcs->createShader)
        return funcs->createShader(type);
    funcs->createShader = qglfResolveCreateShader;
    return GLuint(0);
}

static void qglfResolveDeleteBuffers(GLsizei n, const GLuint* buffers)
{
    typedef void (QGLF_APIENTRYP type_glDeleteBuffers)(GLsizei n, const GLuint* buffers);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->deleteBuffers = (type_glDeleteBuffers)
        context->getProcAddress(QLatin1String("glDeleteBuffers"));
#ifdef QT_OPENGL_ES
    if (!funcs->deleteBuffers) {
        funcs->deleteBuffers = (type_glDeleteBuffers)
            context->getProcAddress(QLatin1String("glDeleteBuffersOES"));
    }
#endif
    if (!funcs->deleteBuffers) {
        funcs->deleteBuffers = (type_glDeleteBuffers)
            context->getProcAddress(QLatin1String("glDeleteBuffersEXT"));
    }
    if (!funcs->deleteBuffers) {
        funcs->deleteBuffers = (type_glDeleteBuffers)
            context->getProcAddress(QLatin1String("glDeleteBuffersARB"));
    }

    if (funcs->deleteBuffers)
        funcs->deleteBuffers(n, buffers);
    else
        funcs->deleteBuffers = qglfResolveDeleteBuffers;
}

static void qglfResolveDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
{
    typedef void (QGLF_APIENTRYP type_glDeleteFramebuffers)(GLsizei n, const GLuint* framebuffers);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->deleteFramebuffers = (type_glDeleteFramebuffers)
        context->getProcAddress(QLatin1String("glDeleteFramebuffers"));
#ifdef QT_OPENGL_ES
    if (!funcs->deleteFramebuffers) {
        funcs->deleteFramebuffers = (type_glDeleteFramebuffers)
            context->getProcAddress(QLatin1String("glDeleteFramebuffersOES"));
    }
#endif
    if (!funcs->deleteFramebuffers) {
        funcs->deleteFramebuffers = (type_glDeleteFramebuffers)
            context->getProcAddress(QLatin1String("glDeleteFramebuffersEXT"));
    }
    if (!funcs->deleteFramebuffers) {
        funcs->deleteFramebuffers = (type_glDeleteFramebuffers)
            context->getProcAddress(QLatin1String("glDeleteFramebuffersARB"));
    }

    if (funcs->deleteFramebuffers)
        funcs->deleteFramebuffers(n, framebuffers);
    else
        funcs->deleteFramebuffers = qglfResolveDeleteFramebuffers;
}

static void qglfResolveDeleteProgram(GLuint program)
{
    typedef void (QGLF_APIENTRYP type_glDeleteProgram)(GLuint program);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->deleteProgram = (type_glDeleteProgram)
        context->getProcAddress(QLatin1String("glDeleteProgram"));
    if (!funcs->deleteProgram) {
        funcs->deleteProgram = (type_glDeleteProgram)
            context->getProcAddress(QLatin1String("glDeleteObjectARB"));
    }

    if (funcs->deleteProgram)
        funcs->deleteProgram(program);
    else
        funcs->deleteProgram = qglfResolveDeleteProgram;
}

static void qglfResolveDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
{
    typedef void (QGLF_APIENTRYP type_glDeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->deleteRenderbuffers = (type_glDeleteRenderbuffers)
        context->getProcAddress(QLatin1String("glDeleteRenderbuffers"));
#ifdef QT_OPENGL_ES
    if (!funcs->deleteRenderbuffers) {
        funcs->deleteRenderbuffers = (type_glDeleteRenderbuffers)
            context->getProcAddress(QLatin1String("glDeleteRenderbuffersOES"));
    }
#endif
    if (!funcs->deleteRenderbuffers) {
        funcs->deleteRenderbuffers = (type_glDeleteRenderbuffers)
            context->getProcAddress(QLatin1String("glDeleteRenderbuffersEXT"));
    }
    if (!funcs->deleteRenderbuffers) {
        funcs->deleteRenderbuffers = (type_glDeleteRenderbuffers)
            context->getProcAddress(QLatin1String("glDeleteRenderbuffersARB"));
    }

    if (funcs->deleteRenderbuffers)
        funcs->deleteRenderbuffers(n, renderbuffers);
    else
        funcs->deleteRenderbuffers = qglfResolveDeleteRenderbuffers;
}

static void qglfResolveDeleteShader(GLuint shader)
{
    typedef void (QGLF_APIENTRYP type_glDeleteShader)(GLuint shader);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->deleteShader = (type_glDeleteShader)
        context->getProcAddress(QLatin1String("glDeleteShader"));
    if (!funcs->deleteShader) {
        funcs->deleteShader = (type_glDeleteShader)
            context->getProcAddress(QLatin1String("glDeleteObjectARB"));
    }

    if (funcs->deleteShader)
        funcs->deleteShader(shader);
    else
        funcs->deleteShader = qglfResolveDeleteShader;
}

static void qglfResolveDetachShader(GLuint program, GLuint shader)
{
    typedef void (QGLF_APIENTRYP type_glDetachShader)(GLuint program, GLuint shader);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->detachShader = (type_glDetachShader)
        context->getProcAddress(QLatin1String("glDetachShader"));
    if (!funcs->detachShader) {
        funcs->detachShader = (type_glDetachShader)
            context->getProcAddress(QLatin1String("glDetachObjectARB"));
    }

    if (funcs->detachShader)
        funcs->detachShader(program, shader);
    else
        funcs->detachShader = qglfResolveDetachShader;
}

static void qglfResolveDisableVertexAttribArray(GLuint index)
{
    typedef void (QGLF_APIENTRYP type_glDisableVertexAttribArray)(GLuint index);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->disableVertexAttribArray = (type_glDisableVertexAttribArray)
        context->getProcAddress(QLatin1String("glDisableVertexAttribArray"));
    if (!funcs->disableVertexAttribArray) {
        funcs->disableVertexAttribArray = (type_glDisableVertexAttribArray)
            context->getProcAddress(QLatin1String("glDisableVertexAttribArrayARB"));
    }

    if (funcs->disableVertexAttribArray)
        funcs->disableVertexAttribArray(index);
    else
        funcs->disableVertexAttribArray = qglfResolveDisableVertexAttribArray;
}

static void qglfResolveEnableVertexAttribArray(GLuint index)
{
    typedef void (QGLF_APIENTRYP type_glEnableVertexAttribArray)(GLuint index);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->enableVertexAttribArray = (type_glEnableVertexAttribArray)
        context->getProcAddress(QLatin1String("glEnableVertexAttribArray"));
    if (!funcs->enableVertexAttribArray) {
        funcs->enableVertexAttribArray = (type_glEnableVertexAttribArray)
            context->getProcAddress(QLatin1String("glEnableVertexAttribArrayARB"));
    }

    if (funcs->enableVertexAttribArray)
        funcs->enableVertexAttribArray(index);
    else
        funcs->enableVertexAttribArray = qglfResolveEnableVertexAttribArray;
}

static void qglfResolveFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
{
    typedef void (QGLF_APIENTRYP type_glFramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->framebufferRenderbuffer = (type_glFramebufferRenderbuffer)
        context->getProcAddress(QLatin1String("glFramebufferRenderbuffer"));
#ifdef QT_OPENGL_ES
    if (!funcs->framebufferRenderbuffer) {
        funcs->framebufferRenderbuffer = (type_glFramebufferRenderbuffer)
            context->getProcAddress(QLatin1String("glFramebufferRenderbufferOES"));
    }
#endif
    if (!funcs->framebufferRenderbuffer) {
        funcs->framebufferRenderbuffer = (type_glFramebufferRenderbuffer)
            context->getProcAddress(QLatin1String("glFramebufferRenderbufferEXT"));
    }
    if (!funcs->framebufferRenderbuffer) {
        funcs->framebufferRenderbuffer = (type_glFramebufferRenderbuffer)
            context->getProcAddress(QLatin1String("glFramebufferRenderbufferARB"));
    }

    if (funcs->framebufferRenderbuffer)
        funcs->framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
    else
        funcs->framebufferRenderbuffer = qglfResolveFramebufferRenderbuffer;
}

static void qglfResolveFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
{
    typedef void (QGLF_APIENTRYP type_glFramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->framebufferTexture2D = (type_glFramebufferTexture2D)
        context->getProcAddress(QLatin1String("glFramebufferTexture2D"));
#ifdef QT_OPENGL_ES
    if (!funcs->framebufferTexture2D) {
        funcs->framebufferTexture2D = (type_glFramebufferTexture2D)
            context->getProcAddress(QLatin1String("glFramebufferTexture2DOES"));
    }
#endif
    if (!funcs->framebufferTexture2D) {
        funcs->framebufferTexture2D = (type_glFramebufferTexture2D)
            context->getProcAddress(QLatin1String("glFramebufferTexture2DEXT"));
    }
    if (!funcs->framebufferTexture2D) {
        funcs->framebufferTexture2D = (type_glFramebufferTexture2D)
            context->getProcAddress(QLatin1String("glFramebufferTexture2DARB"));
    }

    if (funcs->framebufferTexture2D)
        funcs->framebufferTexture2D(target, attachment, textarget, texture, level);
    else
        funcs->framebufferTexture2D = qglfResolveFramebufferTexture2D;
}

static void qglfResolveGenBuffers(GLsizei n, GLuint* buffers)
{
    typedef void (QGLF_APIENTRYP type_glGenBuffers)(GLsizei n, GLuint* buffers);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->genBuffers = (type_glGenBuffers)
        context->getProcAddress(QLatin1String("glGenBuffers"));
#ifdef QT_OPENGL_ES
    if (!funcs->genBuffers) {
        funcs->genBuffers = (type_glGenBuffers)
            context->getProcAddress(QLatin1String("glGenBuffersOES"));
    }
#endif
    if (!funcs->genBuffers) {
        funcs->genBuffers = (type_glGenBuffers)
            context->getProcAddress(QLatin1String("glGenBuffersEXT"));
    }
    if (!funcs->genBuffers) {
        funcs->genBuffers = (type_glGenBuffers)
            context->getProcAddress(QLatin1String("glGenBuffersARB"));
    }

    if (funcs->genBuffers)
        funcs->genBuffers(n, buffers);
    else
        funcs->genBuffers = qglfResolveGenBuffers;
}

static void qglfResolveGenerateMipmap(GLenum target)
{
    typedef void (QGLF_APIENTRYP type_glGenerateMipmap)(GLenum target);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->generateMipmap = (type_glGenerateMipmap)
        context->getProcAddress(QLatin1String("glGenerateMipmap"));
#ifdef QT_OPENGL_ES
    if (!funcs->generateMipmap) {
        funcs->generateMipmap = (type_glGenerateMipmap)
            context->getProcAddress(QLatin1String("glGenerateMipmapOES"));
    }
#endif
    if (!funcs->generateMipmap) {
        funcs->generateMipmap = (type_glGenerateMipmap)
            context->getProcAddress(QLatin1String("glGenerateMipmapEXT"));
    }
    if (!funcs->generateMipmap) {
        funcs->generateMipmap = (type_glGenerateMipmap)
            context->getProcAddress(QLatin1String("glGenerateMipmapARB"));
    }

    if (funcs->generateMipmap)
        funcs->generateMipmap(target);
    else
        funcs->generateMipmap = qglfResolveGenerateMipmap;
}

static void qglfResolveGenFramebuffers(GLsizei n, GLuint* framebuffers)
{
    typedef void (QGLF_APIENTRYP type_glGenFramebuffers)(GLsizei n, GLuint* framebuffers);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->genFramebuffers = (type_glGenFramebuffers)
        context->getProcAddress(QLatin1String("glGenFramebuffers"));
#ifdef QT_OPENGL_ES
    if (!funcs->genFramebuffers) {
        funcs->genFramebuffers = (type_glGenFramebuffers)
            context->getProcAddress(QLatin1String("glGenFramebuffersOES"));
    }
#endif
    if (!funcs->genFramebuffers) {
        funcs->genFramebuffers = (type_glGenFramebuffers)
            context->getProcAddress(QLatin1String("glGenFramebuffersEXT"));
    }
    if (!funcs->genFramebuffers) {
        funcs->genFramebuffers = (type_glGenFramebuffers)
            context->getProcAddress(QLatin1String("glGenFramebuffersARB"));
    }

    if (funcs->genFramebuffers)
        funcs->genFramebuffers(n, framebuffers);
    else
        funcs->genFramebuffers = qglfResolveGenFramebuffers;
}

static void qglfResolveGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
{
    typedef void (QGLF_APIENTRYP type_glGenRenderbuffers)(GLsizei n, GLuint* renderbuffers);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->genRenderbuffers = (type_glGenRenderbuffers)
        context->getProcAddress(QLatin1String("glGenRenderbuffers"));
#ifdef QT_OPENGL_ES
    if (!funcs->genRenderbuffers) {
        funcs->genRenderbuffers = (type_glGenRenderbuffers)
            context->getProcAddress(QLatin1String("glGenRenderbuffersOES"));
    }
#endif
    if (!funcs->genRenderbuffers) {
        funcs->genRenderbuffers = (type_glGenRenderbuffers)
            context->getProcAddress(QLatin1String("glGenRenderbuffersEXT"));
    }
    if (!funcs->genRenderbuffers) {
        funcs->genRenderbuffers = (type_glGenRenderbuffers)
            context->getProcAddress(QLatin1String("glGenRenderbuffersARB"));
    }

    if (funcs->genRenderbuffers)
        funcs->genRenderbuffers(n, renderbuffers);
    else
        funcs->genRenderbuffers = qglfResolveGenRenderbuffers;
}

static void qglfResolveGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
{
    typedef void (QGLF_APIENTRYP type_glGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getActiveAttrib = (type_glGetActiveAttrib)
        context->getProcAddress(QLatin1String("glGetActiveAttrib"));
    if (!funcs->getActiveAttrib) {
        funcs->getActiveAttrib = (type_glGetActiveAttrib)
            context->getProcAddress(QLatin1String("glGetActiveAttribARB"));
    }

    if (funcs->getActiveAttrib)
        funcs->getActiveAttrib(program, index, bufsize, length, size, type, name);
    else
        funcs->getActiveAttrib = qglfResolveGetActiveAttrib;
}

static void qglfResolveGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
{
    typedef void (QGLF_APIENTRYP type_glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getActiveUniform = (type_glGetActiveUniform)
        context->getProcAddress(QLatin1String("glGetActiveUniform"));
    if (!funcs->getActiveUniform) {
        funcs->getActiveUniform = (type_glGetActiveUniform)
            context->getProcAddress(QLatin1String("glGetActiveUniformARB"));
    }

    if (funcs->getActiveUniform)
        funcs->getActiveUniform(program, index, bufsize, length, size, type, name);
    else
        funcs->getActiveUniform = qglfResolveGetActiveUniform;
}

static void qglfResolveGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
{
    typedef void (QGLF_APIENTRYP type_glGetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getAttachedShaders = (type_glGetAttachedShaders)
        context->getProcAddress(QLatin1String("glGetAttachedShaders"));
    if (!funcs->getAttachedShaders) {
        funcs->getAttachedShaders = (type_glGetAttachedShaders)
            context->getProcAddress(QLatin1String("glGetAttachedObjectsARB"));
    }

    if (funcs->getAttachedShaders)
        funcs->getAttachedShaders(program, maxcount, count, shaders);
    else
        funcs->getAttachedShaders = qglfResolveGetAttachedShaders;
}

static int qglfResolveGetAttribLocation(GLuint program, const char* name)
{
    typedef int (QGLF_APIENTRYP type_glGetAttribLocation)(GLuint program, const char* name);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getAttribLocation = (type_glGetAttribLocation)
        context->getProcAddress(QLatin1String("glGetAttribLocation"));
    if (!funcs->getAttribLocation) {
        funcs->getAttribLocation = (type_glGetAttribLocation)
            context->getProcAddress(QLatin1String("glGetAttribLocationARB"));
    }

    if (funcs->getAttribLocation)
        return funcs->getAttribLocation(program, name);
    funcs->getAttribLocation = qglfResolveGetAttribLocation;
    return int(0);
}

static void qglfResolveGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
{
    typedef void (QGLF_APIENTRYP type_glGetBufferParameteriv)(GLenum target, GLenum pname, GLint* params);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getBufferParameteriv = (type_glGetBufferParameteriv)
        context->getProcAddress(QLatin1String("glGetBufferParameteriv"));
#ifdef QT_OPENGL_ES
    if (!funcs->getBufferParameteriv) {
        funcs->getBufferParameteriv = (type_glGetBufferParameteriv)
            context->getProcAddress(QLatin1String("glGetBufferParameterivOES"));
    }
#endif
    if (!funcs->getBufferParameteriv) {
        funcs->getBufferParameteriv = (type_glGetBufferParameteriv)
            context->getProcAddress(QLatin1String("glGetBufferParameterivEXT"));
    }
    if (!funcs->getBufferParameteriv) {
        funcs->getBufferParameteriv = (type_glGetBufferParameteriv)
            context->getProcAddress(QLatin1String("glGetBufferParameterivARB"));
    }

    if (funcs->getBufferParameteriv)
        funcs->getBufferParameteriv(target, pname, params);
    else
        funcs->getBufferParameteriv = qglfResolveGetBufferParameteriv;
}

static void qglfResolveGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
{
    typedef void (QGLF_APIENTRYP type_glGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getFramebufferAttachmentParameteriv = (type_glGetFramebufferAttachmentParameteriv)
        context->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameteriv"));
#ifdef QT_OPENGL_ES
    if (!funcs->getFramebufferAttachmentParameteriv) {
        funcs->getFramebufferAttachmentParameteriv = (type_glGetFramebufferAttachmentParameteriv)
            context->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameterivOES"));
    }
#endif
    if (!funcs->getFramebufferAttachmentParameteriv) {
        funcs->getFramebufferAttachmentParameteriv = (type_glGetFramebufferAttachmentParameteriv)
            context->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameterivEXT"));
    }
    if (!funcs->getFramebufferAttachmentParameteriv) {
        funcs->getFramebufferAttachmentParameteriv = (type_glGetFramebufferAttachmentParameteriv)
            context->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameterivARB"));
    }

    if (funcs->getFramebufferAttachmentParameteriv)
        funcs->getFramebufferAttachmentParameteriv(target, attachment, pname, params);
    else
        funcs->getFramebufferAttachmentParameteriv = qglfResolveGetFramebufferAttachmentParameteriv;
}

static void qglfResolveGetProgramiv(GLuint program, GLenum pname, GLint* params)
{
    typedef void (QGLF_APIENTRYP type_glGetProgramiv)(GLuint program, GLenum pname, GLint* params);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getProgramiv = (type_glGetProgramiv)
        context->getProcAddress(QLatin1String("glGetProgramiv"));
    if (!funcs->getProgramiv) {
        funcs->getProgramiv = (type_glGetProgramiv)
            context->getProcAddress(QLatin1String("glGetObjectParameterivARB"));
    }

    if (funcs->getProgramiv)
        funcs->getProgramiv(program, pname, params);
    else
        funcs->getProgramiv = qglfResolveGetProgramiv;
}

static void qglfResolveGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
{
    typedef void (QGLF_APIENTRYP type_glGetProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getProgramInfoLog = (type_glGetProgramInfoLog)
        context->getProcAddress(QLatin1String("glGetProgramInfoLog"));
    if (!funcs->getProgramInfoLog) {
        funcs->getProgramInfoLog = (type_glGetProgramInfoLog)
            context->getProcAddress(QLatin1String("glGetInfoLogARB"));
    }

    if (funcs->getProgramInfoLog)
        funcs->getProgramInfoLog(program, bufsize, length, infolog);
    else
        funcs->getProgramInfoLog = qglfResolveGetProgramInfoLog;
}

static void qglfResolveGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
{
    typedef void (QGLF_APIENTRYP type_glGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getRenderbufferParameteriv = (type_glGetRenderbufferParameteriv)
        context->getProcAddress(QLatin1String("glGetRenderbufferParameteriv"));
#ifdef QT_OPENGL_ES
    if (!funcs->getRenderbufferParameteriv) {
        funcs->getRenderbufferParameteriv = (type_glGetRenderbufferParameteriv)
            context->getProcAddress(QLatin1String("glGetRenderbufferParameterivOES"));
    }
#endif
    if (!funcs->getRenderbufferParameteriv) {
        funcs->getRenderbufferParameteriv = (type_glGetRenderbufferParameteriv)
            context->getProcAddress(QLatin1String("glGetRenderbufferParameterivEXT"));
    }
    if (!funcs->getRenderbufferParameteriv) {
        funcs->getRenderbufferParameteriv = (type_glGetRenderbufferParameteriv)
            context->getProcAddress(QLatin1String("glGetRenderbufferParameterivARB"));
    }

    if (funcs->getRenderbufferParameteriv)
        funcs->getRenderbufferParameteriv(target, pname, params);
    else
        funcs->getRenderbufferParameteriv = qglfResolveGetRenderbufferParameteriv;
}

static void qglfResolveGetShaderiv(GLuint shader, GLenum pname, GLint* params)
{
    typedef void (QGLF_APIENTRYP type_glGetShaderiv)(GLuint shader, GLenum pname, GLint* params);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getShaderiv = (type_glGetShaderiv)
        context->getProcAddress(QLatin1String("glGetShaderiv"));
    if (!funcs->getShaderiv) {
        funcs->getShaderiv = (type_glGetShaderiv)
            context->getProcAddress(QLatin1String("glGetObjectParameterivARB"));
    }

    if (funcs->getShaderiv)
        funcs->getShaderiv(shader, pname, params);
    else
        funcs->getShaderiv = qglfResolveGetShaderiv;
}

static void qglfResolveGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
{
    typedef void (QGLF_APIENTRYP type_glGetShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getShaderInfoLog = (type_glGetShaderInfoLog)
        context->getProcAddress(QLatin1String("glGetShaderInfoLog"));
    if (!funcs->getShaderInfoLog) {
        funcs->getShaderInfoLog = (type_glGetShaderInfoLog)
            context->getProcAddress(QLatin1String("glGetInfoLogARB"));
    }

    if (funcs->getShaderInfoLog)
        funcs->getShaderInfoLog(shader, bufsize, length, infolog);
    else
        funcs->getShaderInfoLog = qglfResolveGetShaderInfoLog;
}

static void qglfSpecialGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
{
    Q_UNUSED(shadertype);
    Q_UNUSED(precisiontype);
    range[0] = range[1] = precision[0] = 0;
}

static void qglfResolveGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
{
    typedef void (QGLF_APIENTRYP type_glGetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getShaderPrecisionFormat = (type_glGetShaderPrecisionFormat)
        context->getProcAddress(QLatin1String("glGetShaderPrecisionFormat"));
#ifdef QT_OPENGL_ES
    if (!funcs->getShaderPrecisionFormat) {
        funcs->getShaderPrecisionFormat = (type_glGetShaderPrecisionFormat)
            context->getProcAddress(QLatin1String("glGetShaderPrecisionFormatOES"));
    }
#endif
    if (!funcs->getShaderPrecisionFormat) {
        funcs->getShaderPrecisionFormat = (type_glGetShaderPrecisionFormat)
            context->getProcAddress(QLatin1String("glGetShaderPrecisionFormatEXT"));
    }
    if (!funcs->getShaderPrecisionFormat) {
        funcs->getShaderPrecisionFormat = (type_glGetShaderPrecisionFormat)
            context->getProcAddress(QLatin1String("glGetShaderPrecisionFormatARB"));
    }

    if (!funcs->getShaderPrecisionFormat)
        funcs->getShaderPrecisionFormat = qglfSpecialGetShaderPrecisionFormat;

    funcs->getShaderPrecisionFormat(shadertype, precisiontype, range, precision);
}

static void qglfResolveGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
{
    typedef void (QGLF_APIENTRYP type_glGetShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, char* source);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getShaderSource = (type_glGetShaderSource)
        context->getProcAddress(QLatin1String("glGetShaderSource"));
    if (!funcs->getShaderSource) {
        funcs->getShaderSource = (type_glGetShaderSource)
            context->getProcAddress(QLatin1String("glGetShaderSourceARB"));
    }

    if (funcs->getShaderSource)
        funcs->getShaderSource(shader, bufsize, length, source);
    else
        funcs->getShaderSource = qglfResolveGetShaderSource;
}

static void qglfResolveGetUniformfv(GLuint program, GLint location, GLfloat* params)
{
    typedef void (QGLF_APIENTRYP type_glGetUniformfv)(GLuint program, GLint location, GLfloat* params);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getUniformfv = (type_glGetUniformfv)
        context->getProcAddress(QLatin1String("glGetUniformfv"));
    if (!funcs->getUniformfv) {
        funcs->getUniformfv = (type_glGetUniformfv)
            context->getProcAddress(QLatin1String("glGetUniformfvARB"));
    }

    if (funcs->getUniformfv)
        funcs->getUniformfv(program, location, params);
    else
        funcs->getUniformfv = qglfResolveGetUniformfv;
}

static void qglfResolveGetUniformiv(GLuint program, GLint location, GLint* params)
{
    typedef void (QGLF_APIENTRYP type_glGetUniformiv)(GLuint program, GLint location, GLint* params);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getUniformiv = (type_glGetUniformiv)
        context->getProcAddress(QLatin1String("glGetUniformiv"));
    if (!funcs->getUniformiv) {
        funcs->getUniformiv = (type_glGetUniformiv)
            context->getProcAddress(QLatin1String("glGetUniformivARB"));
    }

    if (funcs->getUniformiv)
        funcs->getUniformiv(program, location, params);
    else
        funcs->getUniformiv = qglfResolveGetUniformiv;
}

static int qglfResolveGetUniformLocation(GLuint program, const char* name)
{
    typedef int (QGLF_APIENTRYP type_glGetUniformLocation)(GLuint program, const char* name);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getUniformLocation = (type_glGetUniformLocation)
        context->getProcAddress(QLatin1String("glGetUniformLocation"));
    if (!funcs->getUniformLocation) {
        funcs->getUniformLocation = (type_glGetUniformLocation)
            context->getProcAddress(QLatin1String("glGetUniformLocationARB"));
    }

    if (funcs->getUniformLocation)
        return funcs->getUniformLocation(program, name);
    funcs->getUniformLocation = qglfResolveGetUniformLocation;
    return int(0);
}

static void qglfResolveGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
{
    typedef void (QGLF_APIENTRYP type_glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getVertexAttribfv = (type_glGetVertexAttribfv)
        context->getProcAddress(QLatin1String("glGetVertexAttribfv"));
    if (!funcs->getVertexAttribfv) {
        funcs->getVertexAttribfv = (type_glGetVertexAttribfv)
            context->getProcAddress(QLatin1String("glGetVertexAttribfvARB"));
    }

    if (funcs->getVertexAttribfv)
        funcs->getVertexAttribfv(index, pname, params);
    else
        funcs->getVertexAttribfv = qglfResolveGetVertexAttribfv;
}

static void qglfResolveGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
{
    typedef void (QGLF_APIENTRYP type_glGetVertexAttribiv)(GLuint index, GLenum pname, GLint* params);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getVertexAttribiv = (type_glGetVertexAttribiv)
        context->getProcAddress(QLatin1String("glGetVertexAttribiv"));
    if (!funcs->getVertexAttribiv) {
        funcs->getVertexAttribiv = (type_glGetVertexAttribiv)
            context->getProcAddress(QLatin1String("glGetVertexAttribivARB"));
    }

    if (funcs->getVertexAttribiv)
        funcs->getVertexAttribiv(index, pname, params);
    else
        funcs->getVertexAttribiv = qglfResolveGetVertexAttribiv;
}

static void qglfResolveGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
{
    typedef void (QGLF_APIENTRYP type_glGetVertexAttribPointerv)(GLuint index, GLenum pname, void** pointer);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->getVertexAttribPointerv = (type_glGetVertexAttribPointerv)
        context->getProcAddress(QLatin1String("glGetVertexAttribPointerv"));
    if (!funcs->getVertexAttribPointerv) {
        funcs->getVertexAttribPointerv = (type_glGetVertexAttribPointerv)
            context->getProcAddress(QLatin1String("glGetVertexAttribPointervARB"));
    }

    if (funcs->getVertexAttribPointerv)
        funcs->getVertexAttribPointerv(index, pname, pointer);
    else
        funcs->getVertexAttribPointerv = qglfResolveGetVertexAttribPointerv;
}

static GLboolean qglfResolveIsBuffer(GLuint buffer)
{
    typedef GLboolean (QGLF_APIENTRYP type_glIsBuffer)(GLuint buffer);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->isBuffer = (type_glIsBuffer)
        context->getProcAddress(QLatin1String("glIsBuffer"));
#ifdef QT_OPENGL_ES
    if (!funcs->isBuffer) {
        funcs->isBuffer = (type_glIsBuffer)
            context->getProcAddress(QLatin1String("glIsBufferOES"));
    }
#endif
    if (!funcs->isBuffer) {
        funcs->isBuffer = (type_glIsBuffer)
            context->getProcAddress(QLatin1String("glIsBufferEXT"));
    }
    if (!funcs->isBuffer) {
        funcs->isBuffer = (type_glIsBuffer)
            context->getProcAddress(QLatin1String("glIsBufferARB"));
    }

    if (funcs->isBuffer)
        return funcs->isBuffer(buffer);
    funcs->isBuffer = qglfResolveIsBuffer;
    return GLboolean(0);
}

static GLboolean qglfResolveIsFramebuffer(GLuint framebuffer)
{
    typedef GLboolean (QGLF_APIENTRYP type_glIsFramebuffer)(GLuint framebuffer);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->isFramebuffer = (type_glIsFramebuffer)
        context->getProcAddress(QLatin1String("glIsFramebuffer"));
#ifdef QT_OPENGL_ES
    if (!funcs->isFramebuffer) {
        funcs->isFramebuffer = (type_glIsFramebuffer)
            context->getProcAddress(QLatin1String("glIsFramebufferOES"));
    }
#endif
    if (!funcs->isFramebuffer) {
        funcs->isFramebuffer = (type_glIsFramebuffer)
            context->getProcAddress(QLatin1String("glIsFramebufferEXT"));
    }
    if (!funcs->isFramebuffer) {
        funcs->isFramebuffer = (type_glIsFramebuffer)
            context->getProcAddress(QLatin1String("glIsFramebufferARB"));
    }

    if (funcs->isFramebuffer)
        return funcs->isFramebuffer(framebuffer);
    funcs->isFramebuffer = qglfResolveIsFramebuffer;
    return GLboolean(0);
}

static GLboolean qglfSpecialIsProgram(GLuint program)
{
    return program != 0;
}

static GLboolean qglfResolveIsProgram(GLuint program)
{
    typedef GLboolean (QGLF_APIENTRYP type_glIsProgram)(GLuint program);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->isProgram = (type_glIsProgram)
        context->getProcAddress(QLatin1String("glIsProgram"));
    if (!funcs->isProgram) {
        funcs->isProgram = (type_glIsProgram)
            context->getProcAddress(QLatin1String("glIsProgramARB"));
    }

    if (!funcs->isProgram)
        funcs->isProgram = qglfSpecialIsProgram;

    return funcs->isProgram(program);
}

static GLboolean qglfResolveIsRenderbuffer(GLuint renderbuffer)
{
    typedef GLboolean (QGLF_APIENTRYP type_glIsRenderbuffer)(GLuint renderbuffer);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->isRenderbuffer = (type_glIsRenderbuffer)
        context->getProcAddress(QLatin1String("glIsRenderbuffer"));
#ifdef QT_OPENGL_ES
    if (!funcs->isRenderbuffer) {
        funcs->isRenderbuffer = (type_glIsRenderbuffer)
            context->getProcAddress(QLatin1String("glIsRenderbufferOES"));
    }
#endif
    if (!funcs->isRenderbuffer) {
        funcs->isRenderbuffer = (type_glIsRenderbuffer)
            context->getProcAddress(QLatin1String("glIsRenderbufferEXT"));
    }
    if (!funcs->isRenderbuffer) {
        funcs->isRenderbuffer = (type_glIsRenderbuffer)
            context->getProcAddress(QLatin1String("glIsRenderbufferARB"));
    }

    if (funcs->isRenderbuffer)
        return funcs->isRenderbuffer(renderbuffer);
    funcs->isRenderbuffer = qglfResolveIsRenderbuffer;
    return GLboolean(0);
}

static GLboolean qglfSpecialIsShader(GLuint shader)
{
    return shader != 0;
}

static GLboolean qglfResolveIsShader(GLuint shader)
{
    typedef GLboolean (QGLF_APIENTRYP type_glIsShader)(GLuint shader);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->isShader = (type_glIsShader)
        context->getProcAddress(QLatin1String("glIsShader"));
    if (!funcs->isShader) {
        funcs->isShader = (type_glIsShader)
            context->getProcAddress(QLatin1String("glIsShaderARB"));
    }

    if (!funcs->isShader)
        funcs->isShader = qglfSpecialIsShader;

    return funcs->isShader(shader);
}

static void qglfResolveLinkProgram(GLuint program)
{
    typedef void (QGLF_APIENTRYP type_glLinkProgram)(GLuint program);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->linkProgram = (type_glLinkProgram)
        context->getProcAddress(QLatin1String("glLinkProgram"));
    if (!funcs->linkProgram) {
        funcs->linkProgram = (type_glLinkProgram)
            context->getProcAddress(QLatin1String("glLinkProgramARB"));
    }

    if (funcs->linkProgram)
        funcs->linkProgram(program);
    else
        funcs->linkProgram = qglfResolveLinkProgram;
}

static void qglfSpecialReleaseShaderCompiler()
{
}

static void qglfResolveReleaseShaderCompiler()
{
    typedef void (QGLF_APIENTRYP type_glReleaseShaderCompiler)();

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->releaseShaderCompiler = (type_glReleaseShaderCompiler)
        context->getProcAddress(QLatin1String("glReleaseShaderCompiler"));
    if (!funcs->releaseShaderCompiler) {
        funcs->releaseShaderCompiler = (type_glReleaseShaderCompiler)
            context->getProcAddress(QLatin1String("glReleaseShaderCompilerARB"));
    }

    if (!funcs->releaseShaderCompiler)
        funcs->releaseShaderCompiler = qglfSpecialReleaseShaderCompiler;

    funcs->releaseShaderCompiler();
}

static void qglfResolveRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
{
    typedef void (QGLF_APIENTRYP type_glRenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->renderbufferStorage = (type_glRenderbufferStorage)
        context->getProcAddress(QLatin1String("glRenderbufferStorage"));
#ifdef QT_OPENGL_ES
    if (!funcs->renderbufferStorage) {
        funcs->renderbufferStorage = (type_glRenderbufferStorage)
            context->getProcAddress(QLatin1String("glRenderbufferStorageOES"));
    }
#endif
    if (!funcs->renderbufferStorage) {
        funcs->renderbufferStorage = (type_glRenderbufferStorage)
            context->getProcAddress(QLatin1String("glRenderbufferStorageEXT"));
    }
    if (!funcs->renderbufferStorage) {
        funcs->renderbufferStorage = (type_glRenderbufferStorage)
            context->getProcAddress(QLatin1String("glRenderbufferStorageARB"));
    }

    if (funcs->renderbufferStorage)
        funcs->renderbufferStorage(target, internalformat, width, height);
    else
        funcs->renderbufferStorage = qglfResolveRenderbufferStorage;
}

static void qglfResolveSampleCoverage(GLclampf value, GLboolean invert)
{
    typedef void (QGLF_APIENTRYP type_glSampleCoverage)(GLclampf value, GLboolean invert);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->sampleCoverage = (type_glSampleCoverage)
        context->getProcAddress(QLatin1String("glSampleCoverage"));
#ifdef QT_OPENGL_ES
    if (!funcs->sampleCoverage) {
        funcs->sampleCoverage = (type_glSampleCoverage)
            context->getProcAddress(QLatin1String("glSampleCoverageOES"));
    }
#endif
    if (!funcs->sampleCoverage) {
        funcs->sampleCoverage = (type_glSampleCoverage)
            context->getProcAddress(QLatin1String("glSampleCoverageEXT"));
    }
    if (!funcs->sampleCoverage) {
        funcs->sampleCoverage = (type_glSampleCoverage)
            context->getProcAddress(QLatin1String("glSampleCoverageARB"));
    }

    if (funcs->sampleCoverage)
        funcs->sampleCoverage(value, invert);
    else
        funcs->sampleCoverage = qglfResolveSampleCoverage;
}

static void qglfResolveShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length)
{
    typedef void (QGLF_APIENTRYP type_glShaderBinary)(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->shaderBinary = (type_glShaderBinary)
        context->getProcAddress(QLatin1String("glShaderBinary"));
    if (!funcs->shaderBinary) {
        funcs->shaderBinary = (type_glShaderBinary)
            context->getProcAddress(QLatin1String("glShaderBinaryARB"));
    }

    if (funcs->shaderBinary)
        funcs->shaderBinary(n, shaders, binaryformat, binary, length);
    else
        funcs->shaderBinary = qglfResolveShaderBinary;
}

static void qglfResolveShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
{
    typedef void (QGLF_APIENTRYP type_glShaderSource)(GLuint shader, GLsizei count, const char** string, const GLint* length);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->shaderSource = (type_glShaderSource)
        context->getProcAddress(QLatin1String("glShaderSource"));
    if (!funcs->shaderSource) {
        funcs->shaderSource = (type_glShaderSource)
            context->getProcAddress(QLatin1String("glShaderSourceARB"));
    }

    if (funcs->shaderSource)
        funcs->shaderSource(shader, count, string, length);
    else
        funcs->shaderSource = qglfResolveShaderSource;
}

static void qglfResolveStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
{
    typedef void (QGLF_APIENTRYP type_glStencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->stencilFuncSeparate = (type_glStencilFuncSeparate)
        context->getProcAddress(QLatin1String("glStencilFuncSeparate"));
#ifdef QT_OPENGL_ES
    if (!funcs->stencilFuncSeparate) {
        funcs->stencilFuncSeparate = (type_glStencilFuncSeparate)
            context->getProcAddress(QLatin1String("glStencilFuncSeparateOES"));
    }
#endif
    if (!funcs->stencilFuncSeparate) {
        funcs->stencilFuncSeparate = (type_glStencilFuncSeparate)
            context->getProcAddress(QLatin1String("glStencilFuncSeparateEXT"));
    }
    if (!funcs->stencilFuncSeparate) {
        funcs->stencilFuncSeparate = (type_glStencilFuncSeparate)
            context->getProcAddress(QLatin1String("glStencilFuncSeparateARB"));
    }

    if (funcs->stencilFuncSeparate)
        funcs->stencilFuncSeparate(face, func, ref, mask);
    else
        funcs->stencilFuncSeparate = qglfResolveStencilFuncSeparate;
}

static void qglfResolveStencilMaskSeparate(GLenum face, GLuint mask)
{
    typedef void (QGLF_APIENTRYP type_glStencilMaskSeparate)(GLenum face, GLuint mask);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->stencilMaskSeparate = (type_glStencilMaskSeparate)
        context->getProcAddress(QLatin1String("glStencilMaskSeparate"));
#ifdef QT_OPENGL_ES
    if (!funcs->stencilMaskSeparate) {
        funcs->stencilMaskSeparate = (type_glStencilMaskSeparate)
            context->getProcAddress(QLatin1String("glStencilMaskSeparateOES"));
    }
#endif
    if (!funcs->stencilMaskSeparate) {
        funcs->stencilMaskSeparate = (type_glStencilMaskSeparate)
            context->getProcAddress(QLatin1String("glStencilMaskSeparateEXT"));
    }
    if (!funcs->stencilMaskSeparate) {
        funcs->stencilMaskSeparate = (type_glStencilMaskSeparate)
            context->getProcAddress(QLatin1String("glStencilMaskSeparateARB"));
    }

    if (funcs->stencilMaskSeparate)
        funcs->stencilMaskSeparate(face, mask);
    else
        funcs->stencilMaskSeparate = qglfResolveStencilMaskSeparate;
}

static void qglfResolveStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
{
    typedef void (QGLF_APIENTRYP type_glStencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->stencilOpSeparate = (type_glStencilOpSeparate)
        context->getProcAddress(QLatin1String("glStencilOpSeparate"));
#ifdef QT_OPENGL_ES
    if (!funcs->stencilOpSeparate) {
        funcs->stencilOpSeparate = (type_glStencilOpSeparate)
            context->getProcAddress(QLatin1String("glStencilOpSeparateOES"));
    }
#endif
    if (!funcs->stencilOpSeparate) {
        funcs->stencilOpSeparate = (type_glStencilOpSeparate)
            context->getProcAddress(QLatin1String("glStencilOpSeparateEXT"));
    }
    if (!funcs->stencilOpSeparate) {
        funcs->stencilOpSeparate = (type_glStencilOpSeparate)
            context->getProcAddress(QLatin1String("glStencilOpSeparateARB"));
    }

    if (funcs->stencilOpSeparate)
        funcs->stencilOpSeparate(face, fail, zfail, zpass);
    else
        funcs->stencilOpSeparate = qglfResolveStencilOpSeparate;
}

static void qglfResolveUniform1f(GLint location, GLfloat x)
{
    typedef void (QGLF_APIENTRYP type_glUniform1f)(GLint location, GLfloat x);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniform1f = (type_glUniform1f)
        context->getProcAddress(QLatin1String("glUniform1f"));
    if (!funcs->uniform1f) {
        funcs->uniform1f = (type_glUniform1f)
            context->getProcAddress(QLatin1String("glUniform1fARB"));
    }

    if (funcs->uniform1f)
        funcs->uniform1f(location, x);
    else
        funcs->uniform1f = qglfResolveUniform1f;
}

static void qglfResolveUniform1fv(GLint location, GLsizei count, const GLfloat* v)
{
    typedef void (QGLF_APIENTRYP type_glUniform1fv)(GLint location, GLsizei count, const GLfloat* v);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniform1fv = (type_glUniform1fv)
        context->getProcAddress(QLatin1String("glUniform1fv"));
    if (!funcs->uniform1fv) {
        funcs->uniform1fv = (type_glUniform1fv)
            context->getProcAddress(QLatin1String("glUniform1fvARB"));
    }

    if (funcs->uniform1fv)
        funcs->uniform1fv(location, count, v);
    else
        funcs->uniform1fv = qglfResolveUniform1fv;
}

static void qglfResolveUniform1i(GLint location, GLint x)
{
    typedef void (QGLF_APIENTRYP type_glUniform1i)(GLint location, GLint x);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniform1i = (type_glUniform1i)
        context->getProcAddress(QLatin1String("glUniform1i"));
    if (!funcs->uniform1i) {
        funcs->uniform1i = (type_glUniform1i)
            context->getProcAddress(QLatin1String("glUniform1iARB"));
    }

    if (funcs->uniform1i)
        funcs->uniform1i(location, x);
    else
        funcs->uniform1i = qglfResolveUniform1i;
}

static void qglfResolveUniform1iv(GLint location, GLsizei count, const GLint* v)
{
    typedef void (QGLF_APIENTRYP type_glUniform1iv)(GLint location, GLsizei count, const GLint* v);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniform1iv = (type_glUniform1iv)
        context->getProcAddress(QLatin1String("glUniform1iv"));
    if (!funcs->uniform1iv) {
        funcs->uniform1iv = (type_glUniform1iv)
            context->getProcAddress(QLatin1String("glUniform1ivARB"));
    }

    if (funcs->uniform1iv)
        funcs->uniform1iv(location, count, v);
    else
        funcs->uniform1iv = qglfResolveUniform1iv;
}

static void qglfResolveUniform2f(GLint location, GLfloat x, GLfloat y)
{
    typedef void (QGLF_APIENTRYP type_glUniform2f)(GLint location, GLfloat x, GLfloat y);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniform2f = (type_glUniform2f)
        context->getProcAddress(QLatin1String("glUniform2f"));
    if (!funcs->uniform2f) {
        funcs->uniform2f = (type_glUniform2f)
            context->getProcAddress(QLatin1String("glUniform2fARB"));
    }

    if (funcs->uniform2f)
        funcs->uniform2f(location, x, y);
    else
        funcs->uniform2f = qglfResolveUniform2f;
}

static void qglfResolveUniform2fv(GLint location, GLsizei count, const GLfloat* v)
{
    typedef void (QGLF_APIENTRYP type_glUniform2fv)(GLint location, GLsizei count, const GLfloat* v);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniform2fv = (type_glUniform2fv)
        context->getProcAddress(QLatin1String("glUniform2fv"));
    if (!funcs->uniform2fv) {
        funcs->uniform2fv = (type_glUniform2fv)
            context->getProcAddress(QLatin1String("glUniform2fvARB"));
    }

    if (funcs->uniform2fv)
        funcs->uniform2fv(location, count, v);
    else
        funcs->uniform2fv = qglfResolveUniform2fv;
}

static void qglfResolveUniform2i(GLint location, GLint x, GLint y)
{
    typedef void (QGLF_APIENTRYP type_glUniform2i)(GLint location, GLint x, GLint y);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniform2i = (type_glUniform2i)
        context->getProcAddress(QLatin1String("glUniform2i"));
    if (!funcs->uniform2i) {
        funcs->uniform2i = (type_glUniform2i)
            context->getProcAddress(QLatin1String("glUniform2iARB"));
    }

    if (funcs->uniform2i)
        funcs->uniform2i(location, x, y);
    else
        funcs->uniform2i = qglfResolveUniform2i;
}

static void qglfResolveUniform2iv(GLint location, GLsizei count, const GLint* v)
{
    typedef void (QGLF_APIENTRYP type_glUniform2iv)(GLint location, GLsizei count, const GLint* v);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniform2iv = (type_glUniform2iv)
        context->getProcAddress(QLatin1String("glUniform2iv"));
    if (!funcs->uniform2iv) {
        funcs->uniform2iv = (type_glUniform2iv)
            context->getProcAddress(QLatin1String("glUniform2ivARB"));
    }

    if (funcs->uniform2iv)
        funcs->uniform2iv(location, count, v);
    else
        funcs->uniform2iv = qglfResolveUniform2iv;
}

static void qglfResolveUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
{
    typedef void (QGLF_APIENTRYP type_glUniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniform3f = (type_glUniform3f)
        context->getProcAddress(QLatin1String("glUniform3f"));
    if (!funcs->uniform3f) {
        funcs->uniform3f = (type_glUniform3f)
            context->getProcAddress(QLatin1String("glUniform3fARB"));
    }

    if (funcs->uniform3f)
        funcs->uniform3f(location, x, y, z);
    else
        funcs->uniform3f = qglfResolveUniform3f;
}

static void qglfResolveUniform3fv(GLint location, GLsizei count, const GLfloat* v)
{
    typedef void (QGLF_APIENTRYP type_glUniform3fv)(GLint location, GLsizei count, const GLfloat* v);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniform3fv = (type_glUniform3fv)
        context->getProcAddress(QLatin1String("glUniform3fv"));
    if (!funcs->uniform3fv) {
        funcs->uniform3fv = (type_glUniform3fv)
            context->getProcAddress(QLatin1String("glUniform3fvARB"));
    }

    if (funcs->uniform3fv)
        funcs->uniform3fv(location, count, v);
    else
        funcs->uniform3fv = qglfResolveUniform3fv;
}

static void qglfResolveUniform3i(GLint location, GLint x, GLint y, GLint z)
{
    typedef void (QGLF_APIENTRYP type_glUniform3i)(GLint location, GLint x, GLint y, GLint z);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniform3i = (type_glUniform3i)
        context->getProcAddress(QLatin1String("glUniform3i"));
    if (!funcs->uniform3i) {
        funcs->uniform3i = (type_glUniform3i)
            context->getProcAddress(QLatin1String("glUniform3iARB"));
    }

    if (funcs->uniform3i)
        funcs->uniform3i(location, x, y, z);
    else
        funcs->uniform3i = qglfResolveUniform3i;
}

static void qglfResolveUniform3iv(GLint location, GLsizei count, const GLint* v)
{
    typedef void (QGLF_APIENTRYP type_glUniform3iv)(GLint location, GLsizei count, const GLint* v);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniform3iv = (type_glUniform3iv)
        context->getProcAddress(QLatin1String("glUniform3iv"));
    if (!funcs->uniform3iv) {
        funcs->uniform3iv = (type_glUniform3iv)
            context->getProcAddress(QLatin1String("glUniform3ivARB"));
    }

    if (funcs->uniform3iv)
        funcs->uniform3iv(location, count, v);
    else
        funcs->uniform3iv = qglfResolveUniform3iv;
}

static void qglfResolveUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
    typedef void (QGLF_APIENTRYP type_glUniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniform4f = (type_glUniform4f)
        context->getProcAddress(QLatin1String("glUniform4f"));
    if (!funcs->uniform4f) {
        funcs->uniform4f = (type_glUniform4f)
            context->getProcAddress(QLatin1String("glUniform4fARB"));
    }

    if (funcs->uniform4f)
        funcs->uniform4f(location, x, y, z, w);
    else
        funcs->uniform4f = qglfResolveUniform4f;
}

static void qglfResolveUniform4fv(GLint location, GLsizei count, const GLfloat* v)
{
    typedef void (QGLF_APIENTRYP type_glUniform4fv)(GLint location, GLsizei count, const GLfloat* v);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniform4fv = (type_glUniform4fv)
        context->getProcAddress(QLatin1String("glUniform4fv"));
    if (!funcs->uniform4fv) {
        funcs->uniform4fv = (type_glUniform4fv)
            context->getProcAddress(QLatin1String("glUniform4fvARB"));
    }

    if (funcs->uniform4fv)
        funcs->uniform4fv(location, count, v);
    else
        funcs->uniform4fv = qglfResolveUniform4fv;
}

static void qglfResolveUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
{
    typedef void (QGLF_APIENTRYP type_glUniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniform4i = (type_glUniform4i)
        context->getProcAddress(QLatin1String("glUniform4i"));
    if (!funcs->uniform4i) {
        funcs->uniform4i = (type_glUniform4i)
            context->getProcAddress(QLatin1String("glUniform4iARB"));
    }

    if (funcs->uniform4i)
        funcs->uniform4i(location, x, y, z, w);
    else
        funcs->uniform4i = qglfResolveUniform4i;
}

static void qglfResolveUniform4iv(GLint location, GLsizei count, const GLint* v)
{
    typedef void (QGLF_APIENTRYP type_glUniform4iv)(GLint location, GLsizei count, const GLint* v);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniform4iv = (type_glUniform4iv)
        context->getProcAddress(QLatin1String("glUniform4iv"));
    if (!funcs->uniform4iv) {
        funcs->uniform4iv = (type_glUniform4iv)
            context->getProcAddress(QLatin1String("glUniform4ivARB"));
    }

    if (funcs->uniform4iv)
        funcs->uniform4iv(location, count, v);
    else
        funcs->uniform4iv = qglfResolveUniform4iv;
}

static void qglfResolveUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
    typedef void (QGLF_APIENTRYP type_glUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniformMatrix2fv = (type_glUniformMatrix2fv)
        context->getProcAddress(QLatin1String("glUniformMatrix2fv"));
    if (!funcs->uniformMatrix2fv) {
        funcs->uniformMatrix2fv = (type_glUniformMatrix2fv)
            context->getProcAddress(QLatin1String("glUniformMatrix2fvARB"));
    }

    if (funcs->uniformMatrix2fv)
        funcs->uniformMatrix2fv(location, count, transpose, value);
    else
        funcs->uniformMatrix2fv = qglfResolveUniformMatrix2fv;
}

static void qglfResolveUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
    typedef void (QGLF_APIENTRYP type_glUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniformMatrix3fv = (type_glUniformMatrix3fv)
        context->getProcAddress(QLatin1String("glUniformMatrix3fv"));
    if (!funcs->uniformMatrix3fv) {
        funcs->uniformMatrix3fv = (type_glUniformMatrix3fv)
            context->getProcAddress(QLatin1String("glUniformMatrix3fvARB"));
    }

    if (funcs->uniformMatrix3fv)
        funcs->uniformMatrix3fv(location, count, transpose, value);
    else
        funcs->uniformMatrix3fv = qglfResolveUniformMatrix3fv;
}

static void qglfResolveUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
    typedef void (QGLF_APIENTRYP type_glUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->uniformMatrix4fv = (type_glUniformMatrix4fv)
        context->getProcAddress(QLatin1String("glUniformMatrix4fv"));
    if (!funcs->uniformMatrix4fv) {
        funcs->uniformMatrix4fv = (type_glUniformMatrix4fv)
            context->getProcAddress(QLatin1String("glUniformMatrix4fvARB"));
    }

    if (funcs->uniformMatrix4fv)
        funcs->uniformMatrix4fv(location, count, transpose, value);
    else
        funcs->uniformMatrix4fv = qglfResolveUniformMatrix4fv;
}

static void qglfResolveUseProgram(GLuint program)
{
    typedef void (QGLF_APIENTRYP type_glUseProgram)(GLuint program);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->useProgram = (type_glUseProgram)
        context->getProcAddress(QLatin1String("glUseProgram"));
    if (!funcs->useProgram) {
        funcs->useProgram = (type_glUseProgram)
            context->getProcAddress(QLatin1String("glUseProgramObjectARB"));
    }

    if (funcs->useProgram)
        funcs->useProgram(program);
    else
        funcs->useProgram = qglfResolveUseProgram;
}

static void qglfResolveValidateProgram(GLuint program)
{
    typedef void (QGLF_APIENTRYP type_glValidateProgram)(GLuint program);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->validateProgram = (type_glValidateProgram)
        context->getProcAddress(QLatin1String("glValidateProgram"));
    if (!funcs->validateProgram) {
        funcs->validateProgram = (type_glValidateProgram)
            context->getProcAddress(QLatin1String("glValidateProgramARB"));
    }

    if (funcs->validateProgram)
        funcs->validateProgram(program);
    else
        funcs->validateProgram = qglfResolveValidateProgram;
}

static void qglfResolveVertexAttrib1f(GLuint indx, GLfloat x)
{
    typedef void (QGLF_APIENTRYP type_glVertexAttrib1f)(GLuint indx, GLfloat x);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->vertexAttrib1f = (type_glVertexAttrib1f)
        context->getProcAddress(QLatin1String("glVertexAttrib1f"));
    if (!funcs->vertexAttrib1f) {
        funcs->vertexAttrib1f = (type_glVertexAttrib1f)
            context->getProcAddress(QLatin1String("glVertexAttrib1fARB"));
    }

    if (funcs->vertexAttrib1f)
        funcs->vertexAttrib1f(indx, x);
    else
        funcs->vertexAttrib1f = qglfResolveVertexAttrib1f;
}

static void qglfResolveVertexAttrib1fv(GLuint indx, const GLfloat* values)
{
    typedef void (QGLF_APIENTRYP type_glVertexAttrib1fv)(GLuint indx, const GLfloat* values);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->vertexAttrib1fv = (type_glVertexAttrib1fv)
        context->getProcAddress(QLatin1String("glVertexAttrib1fv"));
    if (!funcs->vertexAttrib1fv) {
        funcs->vertexAttrib1fv = (type_glVertexAttrib1fv)
            context->getProcAddress(QLatin1String("glVertexAttrib1fvARB"));
    }

    if (funcs->vertexAttrib1fv)
        funcs->vertexAttrib1fv(indx, values);
    else
        funcs->vertexAttrib1fv = qglfResolveVertexAttrib1fv;
}

static void qglfResolveVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
{
    typedef void (QGLF_APIENTRYP type_glVertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->vertexAttrib2f = (type_glVertexAttrib2f)
        context->getProcAddress(QLatin1String("glVertexAttrib2f"));
    if (!funcs->vertexAttrib2f) {
        funcs->vertexAttrib2f = (type_glVertexAttrib2f)
            context->getProcAddress(QLatin1String("glVertexAttrib2fARB"));
    }

    if (funcs->vertexAttrib2f)
        funcs->vertexAttrib2f(indx, x, y);
    else
        funcs->vertexAttrib2f = qglfResolveVertexAttrib2f;
}

static void qglfResolveVertexAttrib2fv(GLuint indx, const GLfloat* values)
{
    typedef void (QGLF_APIENTRYP type_glVertexAttrib2fv)(GLuint indx, const GLfloat* values);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->vertexAttrib2fv = (type_glVertexAttrib2fv)
        context->getProcAddress(QLatin1String("glVertexAttrib2fv"));
    if (!funcs->vertexAttrib2fv) {
        funcs->vertexAttrib2fv = (type_glVertexAttrib2fv)
            context->getProcAddress(QLatin1String("glVertexAttrib2fvARB"));
    }

    if (funcs->vertexAttrib2fv)
        funcs->vertexAttrib2fv(indx, values);
    else
        funcs->vertexAttrib2fv = qglfResolveVertexAttrib2fv;
}

static void qglfResolveVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
{
    typedef void (QGLF_APIENTRYP type_glVertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->vertexAttrib3f = (type_glVertexAttrib3f)
        context->getProcAddress(QLatin1String("glVertexAttrib3f"));
    if (!funcs->vertexAttrib3f) {
        funcs->vertexAttrib3f = (type_glVertexAttrib3f)
            context->getProcAddress(QLatin1String("glVertexAttrib3fARB"));
    }

    if (funcs->vertexAttrib3f)
        funcs->vertexAttrib3f(indx, x, y, z);
    else
        funcs->vertexAttrib3f = qglfResolveVertexAttrib3f;
}

static void qglfResolveVertexAttrib3fv(GLuint indx, const GLfloat* values)
{
    typedef void (QGLF_APIENTRYP type_glVertexAttrib3fv)(GLuint indx, const GLfloat* values);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->vertexAttrib3fv = (type_glVertexAttrib3fv)
        context->getProcAddress(QLatin1String("glVertexAttrib3fv"));
    if (!funcs->vertexAttrib3fv) {
        funcs->vertexAttrib3fv = (type_glVertexAttrib3fv)
            context->getProcAddress(QLatin1String("glVertexAttrib3fvARB"));
    }

    if (funcs->vertexAttrib3fv)
        funcs->vertexAttrib3fv(indx, values);
    else
        funcs->vertexAttrib3fv = qglfResolveVertexAttrib3fv;
}

static void qglfResolveVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
    typedef void (QGLF_APIENTRYP type_glVertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->vertexAttrib4f = (type_glVertexAttrib4f)
        context->getProcAddress(QLatin1String("glVertexAttrib4f"));
    if (!funcs->vertexAttrib4f) {
        funcs->vertexAttrib4f = (type_glVertexAttrib4f)
            context->getProcAddress(QLatin1String("glVertexAttrib4fARB"));
    }

    if (funcs->vertexAttrib4f)
        funcs->vertexAttrib4f(indx, x, y, z, w);
    else
        funcs->vertexAttrib4f = qglfResolveVertexAttrib4f;
}

static void qglfResolveVertexAttrib4fv(GLuint indx, const GLfloat* values)
{
    typedef void (QGLF_APIENTRYP type_glVertexAttrib4fv)(GLuint indx, const GLfloat* values);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->vertexAttrib4fv = (type_glVertexAttrib4fv)
        context->getProcAddress(QLatin1String("glVertexAttrib4fv"));
    if (!funcs->vertexAttrib4fv) {
        funcs->vertexAttrib4fv = (type_glVertexAttrib4fv)
            context->getProcAddress(QLatin1String("glVertexAttrib4fvARB"));
    }

    if (funcs->vertexAttrib4fv)
        funcs->vertexAttrib4fv(indx, values);
    else
        funcs->vertexAttrib4fv = qglfResolveVertexAttrib4fv;
}

static void qglfResolveVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
{
    typedef void (QGLF_APIENTRYP type_glVertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);

    const QGLContext *context = QGLContext::currentContext();
    QGLFunctionsPrivate *funcs = qt_gl_functions(context);

    funcs->vertexAttribPointer = (type_glVertexAttribPointer)
        context->getProcAddress(QLatin1String("glVertexAttribPointer"));
    if (!funcs->vertexAttribPointer) {
        funcs->vertexAttribPointer = (type_glVertexAttribPointer)
            context->getProcAddress(QLatin1String("glVertexAttribPointerARB"));
    }

    if (funcs->vertexAttribPointer)
        funcs->vertexAttribPointer(indx, size, type, normalized, stride, ptr);
    else
        funcs->vertexAttribPointer = qglfResolveVertexAttribPointer;
}

#endif // !QT_OPENGL_ES_2

QGLFunctionsPrivate::QGLFunctionsPrivate(const QGLContext *)
{
#ifndef QT_OPENGL_ES_2
    activeTexture = qglfResolveActiveTexture;
    attachShader = qglfResolveAttachShader;
    bindAttribLocation = qglfResolveBindAttribLocation;
    bindBuffer = qglfResolveBindBuffer;
    bindFramebuffer = qglfResolveBindFramebuffer;
    bindRenderbuffer = qglfResolveBindRenderbuffer;
    blendColor = qglfResolveBlendColor;
    blendEquation = qglfResolveBlendEquation;
    blendEquationSeparate = qglfResolveBlendEquationSeparate;
    blendFuncSeparate = qglfResolveBlendFuncSeparate;
    bufferData = qglfResolveBufferData;
    bufferSubData = qglfResolveBufferSubData;
    checkFramebufferStatus = qglfResolveCheckFramebufferStatus;
    compileShader = qglfResolveCompileShader;
    compressedTexImage2D = qglfResolveCompressedTexImage2D;
    compressedTexSubImage2D = qglfResolveCompressedTexSubImage2D;
    createProgram = qglfResolveCreateProgram;
    createShader = qglfResolveCreateShader;
    deleteBuffers = qglfResolveDeleteBuffers;
    deleteFramebuffers = qglfResolveDeleteFramebuffers;
    deleteProgram = qglfResolveDeleteProgram;
    deleteRenderbuffers = qglfResolveDeleteRenderbuffers;
    deleteShader = qglfResolveDeleteShader;
    detachShader = qglfResolveDetachShader;
    disableVertexAttribArray = qglfResolveDisableVertexAttribArray;
    enableVertexAttribArray = qglfResolveEnableVertexAttribArray;
    framebufferRenderbuffer = qglfResolveFramebufferRenderbuffer;
    framebufferTexture2D = qglfResolveFramebufferTexture2D;
    genBuffers = qglfResolveGenBuffers;
    generateMipmap = qglfResolveGenerateMipmap;
    genFramebuffers = qglfResolveGenFramebuffers;
    genRenderbuffers = qglfResolveGenRenderbuffers;
    getActiveAttrib = qglfResolveGetActiveAttrib;
    getActiveUniform = qglfResolveGetActiveUniform;
    getAttachedShaders = qglfResolveGetAttachedShaders;
    getAttribLocation = qglfResolveGetAttribLocation;
    getBufferParameteriv = qglfResolveGetBufferParameteriv;
    getFramebufferAttachmentParameteriv = qglfResolveGetFramebufferAttachmentParameteriv;
    getProgramiv = qglfResolveGetProgramiv;
    getProgramInfoLog = qglfResolveGetProgramInfoLog;
    getRenderbufferParameteriv = qglfResolveGetRenderbufferParameteriv;
    getShaderiv = qglfResolveGetShaderiv;
    getShaderInfoLog = qglfResolveGetShaderInfoLog;
    getShaderPrecisionFormat = qglfResolveGetShaderPrecisionFormat;
    getShaderSource = qglfResolveGetShaderSource;
    getUniformfv = qglfResolveGetUniformfv;
    getUniformiv = qglfResolveGetUniformiv;
    getUniformLocation = qglfResolveGetUniformLocation;
    getVertexAttribfv = qglfResolveGetVertexAttribfv;
    getVertexAttribiv = qglfResolveGetVertexAttribiv;
    getVertexAttribPointerv = qglfResolveGetVertexAttribPointerv;
    isBuffer = qglfResolveIsBuffer;
    isFramebuffer = qglfResolveIsFramebuffer;
    isProgram = qglfResolveIsProgram;
    isRenderbuffer = qglfResolveIsRenderbuffer;
    isShader = qglfResolveIsShader;
    linkProgram = qglfResolveLinkProgram;
    releaseShaderCompiler = qglfResolveReleaseShaderCompiler;
    renderbufferStorage = qglfResolveRenderbufferStorage;
    sampleCoverage = qglfResolveSampleCoverage;
    shaderBinary = qglfResolveShaderBinary;
    shaderSource = qglfResolveShaderSource;
    stencilFuncSeparate = qglfResolveStencilFuncSeparate;
    stencilMaskSeparate = qglfResolveStencilMaskSeparate;
    stencilOpSeparate = qglfResolveStencilOpSeparate;
    uniform1f = qglfResolveUniform1f;
    uniform1fv = qglfResolveUniform1fv;
    uniform1i = qglfResolveUniform1i;
    uniform1iv = qglfResolveUniform1iv;
    uniform2f = qglfResolveUniform2f;
    uniform2fv = qglfResolveUniform2fv;
    uniform2i = qglfResolveUniform2i;
    uniform2iv = qglfResolveUniform2iv;
    uniform3f = qglfResolveUniform3f;
    uniform3fv = qglfResolveUniform3fv;
    uniform3i = qglfResolveUniform3i;
    uniform3iv = qglfResolveUniform3iv;
    uniform4f = qglfResolveUniform4f;
    uniform4fv = qglfResolveUniform4fv;
    uniform4i = qglfResolveUniform4i;
    uniform4iv = qglfResolveUniform4iv;
    uniformMatrix2fv = qglfResolveUniformMatrix2fv;
    uniformMatrix3fv = qglfResolveUniformMatrix3fv;
    uniformMatrix4fv = qglfResolveUniformMatrix4fv;
    useProgram = qglfResolveUseProgram;
    validateProgram = qglfResolveValidateProgram;
    vertexAttrib1f = qglfResolveVertexAttrib1f;
    vertexAttrib1fv = qglfResolveVertexAttrib1fv;
    vertexAttrib2f = qglfResolveVertexAttrib2f;
    vertexAttrib2fv = qglfResolveVertexAttrib2fv;
    vertexAttrib3f = qglfResolveVertexAttrib3f;
    vertexAttrib3fv = qglfResolveVertexAttrib3fv;
    vertexAttrib4f = qglfResolveVertexAttrib4f;
    vertexAttrib4fv = qglfResolveVertexAttrib4fv;
    vertexAttribPointer = qglfResolveVertexAttribPointer;
#endif // !QT_OPENGL_ES_2
}

QT_END_NAMESPACE