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
|
/*
# BUILD api_versions [0x100, 0x101, 0x102, 0x103]
# BUILD macro_template 'defined(GLU_VERSION_%(api_version_underscore)s)'
# BUILD shadow 1
*/
%module GLU__init__
#define __version__ "$Revision: 1.1 $"
#define __date__ "$Date: 2003/10/19 04:09:43 $"
#define __api_version__ API_VERSION
#define __author__ "Tarn Weisner Burton <twburton@users.sourceforge.net>"
#define __doc__ "http:\057\057www.opengl.org\057developers\057documentation\057glx.html"
%{
/**
*
* GLU Module for PyOpenGL
*
* Date: May 2001
*
* Authors: Tarn Weisner Burton <twburton@users.sourceforge.net>
*
***/
/* License from SGI's OpenGL Sample Implementation */
/*
# License Applicability. Except to the extent portions of this file are
# made subject to an alternative license as permitted in the SGI Free
# Software License B, Version 1.1 (the "License"), the contents of this
# file are subject only to the provisions of the License. You may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
# Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
#
# http://oss.sgi.com/projects/FreeB
#
# Note that, as provided in the License, the Software is distributed on an
# "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
# DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
# CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
# PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
#
# Original Code. The Original Code is: OpenGL Sample Implementation,
# Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
# Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
# Copyright in any portions created by third parties is as indicated
# elsewhere herein. All Rights Reserved.
#
# Additional Notice Provisions: The application programming interfaces
# established by SGI in conjunction with the Original Code are The
# OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
# April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
# 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
# Window System(R) (Version 1.3), released October 19, 1998. This software
# was created using the OpenGL(R) version 1.2.1 Sample Implementation
# published by SGI, but has not been independently verified as being
# compliant with the OpenGL(R) version 1.2.1 Specification.
*/
%}
%include util.inc
%init %{
PyDict_SetItemString(d, "GLUerror", GLUerror);
%}
%{
void __ignoreDeletionCall(PyObject * tess ) {
}
%}
%shadow %{
#-------------- SHADOW WRAPPERS ------------------
%}
%{
typedef void (CALLBACK *callback)();
%}
/* yes we need this, GLU often doesn't clear GL errors */
GL_EXCEPTION_HANDLER()
/*
# gluErrorString
#
# Python binding unchanged from spec.
*/
const GLubyte* gluErrorString(GLenum errCode);
DOC(gluErrorString, "gluErrorString(errCode) -> string")
/* this isn't working right now! */
/*const wchar_t* gluErrorUnicodeStringEXT(GLenum errCode); */
/*DOC(gluErrorUnicodeStringEXT, "gluErrorUnicodeStringEXT(errCode) -> string") */
/*
# gluGetString
#
# Python binding unchanged from spec.
*/
#if API_VERSION >= 257
const GLubyte* gluGetString(GLenum name);
DOC(gluGetString, "gluGetString(name) -> string")
#endif
/*
# gluCheckExtension
#
# Python binding unchanged from spec.
*/
#if API_VERSION >= 259 /* GLU 1.3 */
GLboolean gluCheckExtension( const char *extName, const char *extString );
DOC(gluCheckExtension, "gluCheckExtension(extName, extString) -> bool")
#endif
/*
# gluOrtho2D
#
# Python binding unchanged from spec.
*/
void gluOrtho2D(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top);
DOC(gluOrtho2D, "gluOrtho2D(left, right, bottom, top) -> None")
/*
# gluPerspective
#
# Python binding unchanged from spec.
*/
void gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
DOC(gluPerspective, "gluPerspective(fovy, aspect, zNear, zFar) -> None")
/*
# gluPickMatrix
#
# Python binding unchanged from spec, except "viewport" parameter is a keyword
*/
%{
void __gluPickMatrix(GLdouble x, GLdouble y, GLdouble width, GLdouble height, const GLint *viewport)
{
GLint _viewport[4];
if (!viewport)
{
glGetIntegerv(GL_VIEWPORT, _viewport);
viewport = _viewport;
}
gluPickMatrix(x, y, width, height, (GLint*)viewport);
}
%}
void __gluPickMatrix(GLdouble x, GLdouble y, GLdouble width, GLdouble height, const GLint *viewport);
%shadow %{
def gluPickMatrix(x, y, width, height, viewport = None):
'gluPickMatrix(x, y, width, height, viewport = None) -> None'
return __gluPickMatrix(x, y, width, height, viewport)
%}
/*
# gluLookAt
#
# Python binding unchanged from spec.
*/
void gluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez, GLdouble centerx, GLdouble centery, GLdouble centerz,
GLdouble upx, GLdouble upy, GLdouble upz);
DOC(gluLookAt, "gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz) -> None")
/*
# gluProject
#
# Python binding unchanged from spec, except "modelMatrix", "projMatrix", and "viewport"
# parameters are keywords.
*/
%{
PyObject* __gluProject(GLdouble objx, GLdouble objy, GLdouble objz, const GLdouble *modelMatrix, const GLdouble *projMatrix, const GLint *viewport)
{
GLdouble win[3], _modelMatrix[16], _projMatrix[16];
GLint _viewport[4];
if (!modelMatrix)
{
glGetDoublev(GL_MODELVIEW_MATRIX, _modelMatrix);
modelMatrix = _modelMatrix;
}
if (!projMatrix)
{
glGetDoublev(GL_PROJECTION_MATRIX, _projMatrix);
projMatrix = _projMatrix;
}
if (!viewport)
{
glGetIntegerv(GL_VIEWPORT, _viewport);
viewport = _viewport;
}
if (gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, win, win + 1, win + 2))
{
return _PyTuple_FromDoubleArray(3, win);
}
PyErr_SetGLUerror( GL_INVALID_VALUE );
return NULL;
}
%}
PyObject* __gluProject(GLdouble objx, GLdouble objy, GLdouble objz, const GLdouble *modelMatrix, const GLdouble *projMatrix, const GLint *viewport);
%shadow %{
def gluProject(objx, objy, objz, modelMatrix = None, projMatrix = None, viewport = None):
'gluProject(objx, objy, objz, modelMatrix = None, projMatrix = None, viewport = None) -> (winx, winy, winz)'
return __gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport)
%}
/*
# gluUnProject
#
# Python binding unchanged from spec, except "modelMatrix", "projMatrix", and "viewport"
# parameters are keywords.
*/
%{
PyObject* __gluUnProject(GLdouble winx, GLdouble winy, GLdouble winz, const GLdouble *modelMatrix, const GLdouble *projMatrix, const GLint *viewport)
{
GLdouble obj[3], _modelMatrix[16], _projMatrix[16];
GLint _viewport[4];
if (!modelMatrix)
{
glGetDoublev(GL_MODELVIEW_MATRIX, _modelMatrix);
modelMatrix = _modelMatrix;
}
if (!projMatrix)
{
glGetDoublev(GL_PROJECTION_MATRIX, _projMatrix);
projMatrix = _projMatrix;
}
if (!viewport)
{
glGetIntegerv(GL_VIEWPORT, _viewport);
viewport = _viewport;
}
if (gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, obj, obj + 1, obj + 2))
{
return _PyTuple_FromDoubleArray(3, obj);
}
Py_INCREF(Py_None);
return Py_None;
}
%}
PyObject* __gluUnProject(GLdouble winx, GLdouble winy, GLdouble winz, const GLdouble *modelMatrix, const GLdouble *projMatrix,
const GLint *viewport);
%shadow %{
def gluUnProject(winx, winy, winz, modelMatrix = None, projMatrix = None, viewport = None):
'gluUnProject(winx, winy, winz, modelMatrix = None, projMatrix = None, viewport = None) -> (objx, objy, objz)'
return __gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport)
%}
/*
# gluUnProject4
#
# Python binding unchanged from spec, except "modelMatrix", "projMatrix", "viewport",
# "near", and "far" parameters are keywords.
*/
#if API_VERSION >= 259
%{
PyObject* __gluUnProject4(GLdouble winx, GLdouble winy, GLdouble winz, GLdouble clipW, const GLdouble *modelMatrix, const GLdouble *projMatrix, const GLint *viewport, GLclampd near, GLclampd far)
{
GLdouble obj[4], _modelMatrix[16], _projMatrix[16];
GLint _viewport[4];
if (!modelMatrix)
{
glGetDoublev(GL_MODELVIEW_MATRIX, _modelMatrix);
modelMatrix = _modelMatrix;
}
if (!projMatrix)
{
glGetDoublev(GL_PROJECTION_MATRIX, _projMatrix);
projMatrix = _projMatrix;
}
if (!viewport)
{
glGetIntegerv(GL_VIEWPORT, _viewport);
viewport = _viewport;
}
if (gluUnProject4(winx, winy, winz, clipW, modelMatrix, projMatrix, viewport, near, far, obj, obj + 1, obj + 2, obj + 3))
{
return _PyTuple_FromDoubleArray(4, obj);
}
Py_INCREF(Py_None);
return Py_None;
}
%}
PyObject* __gluUnProject4(GLdouble winx, GLdouble winy, GLdouble winz, GLdouble clipW, const GLdouble *modelMatrix, const GLdouble *projMatrix,
const GLint *viewport, GLclampd near, GLclampd far);
%shadow %{
def gluUnProject4(winx, winy, winz, clipW, modelMatrix = None, projMatrix = None, viewport = None, near = 0.0, far = 1.0):
'gluUnProject4(winx, winy, winz, clipW, modelMatrix = None, projMatrix = None, viewport = None, near = 0.0, far = 1.0) -> (objx, objy, objz, objw)'
return __gluUnProject4(winx, winy, winz, clipW, modelMatrix, projMatrix, viewport, near, far)
%}
#endif
/*
# gluScaleImage
#
# Python binding unchanged from spec with the addition of the decorated variants which omit all width, height or type
# parameters and ignore pixel storage settings.
*/
%{
PyObject* _gluScaleImage(GLenum format, GLint widthin, GLint heightin, GLenum typein, const void *datain, GLint widthout,
GLint heightout, GLenum typeout)
{
PyObject* result;
int code, dims[2];
int size;
void* dataout;
dims[0] = widthout;
dims[1] = heightout;
dataout = SetupRawPixelRead(format, typeout, 2, dims, &size);
if (!dataout) return NULL;
code = gluScaleImage(format, widthin, heightin, typein, datain, widthout, heightout, typeout, dataout);
if (code)
{
PyMem_Del(dataout);
PyErr_SetGLUerror(code);
return NULL;
}
result = PyString_FromStringAndSize((const char*)dataout, size);
PyMem_Del(dataout);
return result;
}
PyObject* __gluScaleImage(GLenum format, GLint widthin, GLint heightin, GLenum type, const void *datain, GLint widthout, GLint heightout)
{
int dims[3], code;
void *dataout;
SetupPixelWrite(2);
dims[0] = widthout;
dims[1] = heightout;
dataout = SetupPixelRead(2, format, type, dims);
if (!dataout) return NULL;
code = gluScaleImage(format, widthin, heightin, type, datain, widthout, heightout, type, dataout);
if (code)
{
PyMem_Del(dataout);
PyErr_SetGLUerror(code);
return NULL;
}
return _PyObject_FromArray(type, (dims[2] == 1) ? 2 : 3, dims, dataout, 1);
}
%}
%name(gluScaleImage) PyObject* _gluScaleImage(GLenum format, GLint widthin, GLint heightin, GLenum typein, PyObject *datain, GLint widthout,
GLint heightout, GLenum typeout);
DOC(gluScaleImage, "gluScaleImage(format, widthin, heightin, typein, datain, widthout, heightout, typeout) -> dataout")
%name(gluScaleImageb) PyObject *__gluScaleImage(GLenum format, GLint d_4_1, GLint d_4_0, GLenum type_BYTE, const GLbyte* datain, GLint widthout, GLint heightout);
DOC(gluScaleImageb, "gluScaleImageb(format, datain, widthout, heightout) -> dataout")
%name(gluScaleImageub) PyObject *__gluScaleImage(GLenum format, GLint d_4_1, GLint d_4_0, GLenum type_UNSIGNED_BYTE, const GLubyte* datain, GLint widthout, GLint heightout);
DOC(gluScaleImageub, "gluScaleImageub(format, datain, widthout, heightout) -> dataout")
%name(gluScaleImages) PyObject *__gluScaleImage(GLenum format, GLint d_4_1, GLint d_4_0, GLenum type_SHORT, const GLshort* datain, GLint widthout, GLint heightout);
DOC(gluScaleImages, "gluScaleImages(format, datain, widthout, heightout) -> dataout")
%name(gluScaleImageus) PyObject *__gluScaleImage(GLenum format, GLint d_4_1, GLint d_4_0, GLenum type_UNSIGNED_SHORT, const GLushort* datain, GLint widthout, GLint heightout);
DOC(gluScaleImageus, "gluScaleImageus(format, datain, widthout, heightout) -> dataout")
%name(gluScaleImagei) PyObject *__gluScaleImage(GLenum format, GLint d_4_1, GLint d_4_0, GLenum type_INT, const GLint* datain, GLint widthout, GLint heightout);
DOC(gluScaleImagei, "gluScaleImagei(format, datain, widthout, heightout) -> dataout")
%name(gluScaleImageui) PyObject *__gluScaleImage(GLenum format, GLint d_4_1, GLint d_4_0, GLenum type_UNSIGNED_INT, const GLuint* datain, GLint widthout, GLint heightout);
DOC(gluScaleImageui, "gluScaleImageui(format, datain, widthout, heightout) -> dataout")
%name(gluScaleImagef) PyObject *__gluScaleImage(GLenum format, GLint d_4_1, GLint d_4_0, GLenum type_FLOAT, const GLfloat* datain, GLint widthout, GLint heightout);
DOC(gluScaleImagef, "gluScaleImagef(format, datain, widthout, heightout) -> dataout")
/*
# gluBuild1DMipmaps
#
# Python binding unchanged from spec with the addition of the decorated variants which omit all width, height or type
# parameters and ignore pixel storage settings.
*/
%{
PyObject* _gluBuild1DMipmaps(GLenum target, GLint components, GLint width, GLenum format, GLenum type, const void *buffer)
{
int code;
code = gluBuild1DMipmaps(target, components, width, format, type, buffer);
if (code)
{
PyErr_SetGLUerror(code);
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
%}
%name(gluBuild1DMipmaps) PyObject* _gluBuild1DMipmaps(GLenum target, GLint components, GLint width, GLenum format, GLenum type, const void *buffer);
DOC(gluBuild1DMipmaps, "gluBuild1DMipmaps(target, components, width, format, type, data) -> None")
%{
PyObject *__gluBuild1DMipmaps(GLenum target, GLint components, GLint width, GLenum format, GLenum type, const void *buffer)
{
int code;
SetupPixelWrite(1);
code = gluBuild1DMipmaps(target, components, width, format, type, buffer);
if (code)
{
PyErr_SetGLUerror(code);
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
%}
%name(gluBuild1DMipmapsb) PyObject *__gluBuild1DMipmaps(GLenum target, GLint components, GLint d_5_0, GLenum format, GLenum type_BYTE, const GLbyte *buffer);
DOC(gluBuild1DMipmapsb, "gluBuild1DMipmapsb(target, components, format, pixels) -> None")
%name(gluBuild1DMipmapsub) PyObject *__gluBuild1DMipmaps(GLenum target, GLint components, GLint d_5_0, GLenum format, GLenum type_UNSIGNED_BYTE, const GLubyte *buffer);
DOC(gluBuild1DMipmapsub, "gluBuild1DMipmapsub(target, components, format, pixels) -> None")
%name(gluBuild1DMipmapss) PyObject *__gluBuild1DMipmaps(GLenum target, GLint components, GLint d_5_0, GLenum format, GLenum type_SHORT, const GLshort *buffer);
DOC(gluBuild1DMipmapss, "gluBuild1DMipmapss(target, components, format, pixels) -> None")
%name(gluBuild1DMipmapsus) PyObject *__gluBuild1DMipmaps(GLenum target, GLint components, GLint d_5_0, GLenum format, GLenum type_UNSIGNED_SHORT, const GLushort *buffer);
DOC(gluBuild1DMipmapsus, "gluBuild1DMipmapsus(target, components, format, pixels) -> None")
%name(gluBuild1DMipmapsi) PyObject *__gluBuild1DMipmaps(GLenum target, GLint components, GLint d_5_0, GLenum format, GLenum type_INT, const GLint *buffer);
DOC(gluBuild1DMipmapsi, "gluBuild1DMipmapsi(target, components, format, pixels) -> None")
%name(gluBuild1DMipmapsui) PyObject *__gluBuild1DMipmaps(GLenum target, GLint components, GLint d_5_0, GLenum format, GLenum type_UNSIGNED_INT, const GLuint *buffer);
DOC(gluBuild1DMipmapsui, "gluBuild1DMipmapsui(target, components, format, pixels) -> None")
%name(gluBuild1DMipmapsf) PyObject *__gluBuild1DMipmaps(GLenum target, GLint components, GLint d_5_0, GLenum format, GLenum type_FLOAT, const GLshort *buffer);
DOC(gluBuild1DMipmapsf, "gluBuild1DMipmapsf(target, components, format, pixels) -> None")
/*
# gluBuild2DMipmaps
#
# Python binding unchanged from spec with the addition of the decorated variants which omit all width, height or type
# parameters and ignore pixel storage settings.
*/
%{
PyObject* _gluBuild2DMipmaps(GLenum target, GLint components, GLint width, GLint height, GLenum format, GLenum type, const void *buffer)
{
int code;
code = gluBuild2DMipmaps(target, components, width, height, format, type, buffer);
if (code)
{
PyErr_SetGLUerror(code);
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
%}
%name(gluBuild2DMipmaps) PyObject* _gluBuild2DMipmaps(GLenum target, GLint components, GLint width, GLint height, GLenum format, GLenum type, const void *buffer);
DOC(gluBuild2DMipmaps, "gluBuild2DMipmaps(target, components, width, height, format, type, data) -> None")
%{
PyObject *__gluBuild2DMipmaps(GLenum target, GLint components, GLint width, GLint height, GLenum format, GLenum type, const void *buffer)
{
int code;
SetupPixelWrite(2);
code = gluBuild2DMipmaps(target, components, width, height, format, type, buffer);
if (code)
{
PyErr_SetGLUerror(code);
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
%}
%name(gluBuild2DMipmapsb) PyObject *__gluBuild2DMipmaps(GLenum target, GLint components, GLint d_6_1, GLint d_6_0, GLenum format, GLenum type_BYTE, const GLbyte *buffer);
DOC(gluBuild2DMipmapsb, "gluBuild2DMipmapsb(target, components, format, pixels) -> None")
%name(gluBuild2DMipmapsub) PyObject *__gluBuild2DMipmaps(GLenum target, GLint components, GLint d_6_1, GLint d_6_0, GLenum format, GLenum type_UNSIGNED_BYTE, const GLubyte *buffer);
DOC(gluBuild2DMipmapsub, "gluBuild2DMipmapsub(target, components, format, pixels) -> None")
%name(gluBuild2DMipmapss) PyObject *__gluBuild2DMipmaps(GLenum target, GLint components, GLint d_6_1, GLint d_6_0, GLenum format, GLenum type_SHORT, const GLshort *buffer);
DOC(gluBuild2DMipmapss, "gluBuild2DMipmapss(target, components, format, pixels) -> None")
%name(gluBuild2DMipmapsus) PyObject *__gluBuild2DMipmaps(GLenum target, GLint components, GLint d_6_1, GLint d_6_0, GLenum format, GLenum type_UNSIGNED_SHORT, const GLushort *buffer);
DOC(gluBuild2DMipmapsus, "gluBuild2DMipmapsus(target, components, format, pixels) -> None")
%name(gluBuild2DMipmapsi) PyObject *__gluBuild2DMipmaps(GLenum target, GLint components, GLint d_6_1, GLint d_6_0, GLenum format, GLenum type_INT, const GLint *buffer);
DOC(gluBuild2DMipmapsi, "gluBuild2DMipmapsi(target, components, format, pixels) -> None")
%name(gluBuild2DMipmapsui) PyObject *__gluBuild2DMipmaps(GLenum target, GLint components, GLint d_6_1, GLint d_6_0, GLenum format, GLenum type_UNSIGNED_INT, const GLuint *buffer);
DOC(gluBuild2DMipmapsui, "gluBuild2DMipmapsui(target, components, format, pixels) -> None")
%name(gluBuild2DMipmapsf) PyObject *__gluBuild2DMipmaps(GLenum target, GLint components, GLint d_6_1, GLint d_6_0, GLenum format, GLenum type_FLOAT, const GLshort *buffer);
DOC(gluBuild2DMipmapsf, "gluBuild2DMipmapsf(target, components, format, pixels) -> None")
/*
# gluBuild3DMipmaps
#
# Python binding unchanged from spec with the addition of the decorated variants which omit all width, height or type
# parameters and ignore pixel storage settings.
*/
#if API_VERSION >= 259
%{
PyObject* _gluBuild3DMipmaps(GLenum target, GLint components, GLint width, GLint height, GLint depth, GLenum format, GLenum type, const void *buffer)
{
int code;
code = gluBuild3DMipmaps(target, components, width, height, depth, format, type, buffer);
if (code)
{
PyErr_SetGLUerror(code);
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
%}
%name(gluBuild3DMipmaps) PyObject* _gluBuild3DMipmaps(GLenum target, GLint components, GLint width, GLint height, GLint depth, GLenum format, GLenum type, const void *buffer);
DOC(gluBuild3DMipmaps, "gluBuild3DMipmaps(target, components, width, height, depth, format, type, data) -> None")
%{
PyObject *__gluBuild3DMipmaps(GLenum target, GLint components, GLint width, GLint height, GLint depth, GLenum format, GLenum type, const void *buffer)
{
int code;
SetupPixelWrite(2);
code = gluBuild3DMipmaps(target, components, width, height, depth, format, type, buffer);
if (code)
{
PyErr_SetGLUerror(code);
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
%}
%name(gluBuild3DMipmapsb) PyObject *__gluBuild3DMipmaps(GLenum target, GLint components, GLint d_6_2, GLint d_6_1, GLint d_6_0, GLenum format, GLenum type_BYTE, const GLbyte *buffer);
DOC(gluBuild3DMipmapsb, "gluBuild3DMipmapsb(target, components, format, pixels) -> None")
%name(gluBuild3DMipmapsub) PyObject *__gluBuild3DMipmaps(GLenum target, GLint components, GLint d_6_2, GLint d_6_1, GLint d_6_0, GLenum format, GLenum type_UNSIGNED_BYTE, const GLubyte *buffer);
DOC(gluBuild3DMipmapsub, "gluBuild3DMipmapsub(target, components, format, pixels) -> None")
%name(gluBuild3DMipmapss) PyObject *__gluBuild3DMipmaps(GLenum target, GLint components, GLint d_6_2, GLint d_6_1, GLint d_6_0, GLenum format, GLenum type_SHORT, const GLshort *buffer);
DOC(gluBuild3DMipmapss, "gluBuild3DMipmapss(target, components, format, pixels) -> None")
%name(gluBuild3DMipmapsus) PyObject *__gluBuild3DMipmaps(GLenum target, GLint components, GLint d_6_2, GLint d_6_1, GLint d_6_0, GLenum format, GLenum type_UNSIGNED_SHORT, const GLushort *buffer);
DOC(gluBuild3DMipmapsus, "gluBuild3DMipmapsus(target, components, format, pixels) -> None")
%name(gluBuild3DMipmapsi) PyObject *__gluBuild3DMipmaps(GLenum target, GLint components, GLint d_6_2, GLint d_6_1, GLint d_6_0, GLenum format, GLenum type_INT, const GLint *buffer);
DOC(gluBuild3DMipmapsi, "gluBuild3DMipmapsi(target, components, format, pixels) -> None")
%name(gluBuild3DMipmapsui) PyObject *__gluBuild3DMipmaps(GLenum target, GLint components, GLint d_6_2, GLint d_6_1, GLint d_6_0, GLenum format, GLenum type_UNSIGNED_INT, const GLuint *buffer);
DOC(gluBuild3DMipmapsui, "gluBuild3DMipmapsui(target, components, format, pixels) -> None")
%name(gluBuild3DMipmapsf) PyObject *__gluBuild3DMipmaps(GLenum target, GLint components, GLint d_6_2, GLint d_6_1, GLint d_6_0, GLenum format, GLenum type_FLOAT, const GLshort *buffer);
DOC(gluBuild3DMipmapsf, "gluBuild3DMipmapsf(target, components, format, pixels) -> None")
/*int gluBuild1DMipmapLevels(GLenum target, GLint components, GLint width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data); */
%{
PyObject* _gluBuild1DMipmapLevels(GLenum target, GLint components, GLint width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *buffer)
{
int code;
code = gluBuild1DMipmapLevels(target, components, width, format, type, level, base, max, buffer);
if (code)
{
PyErr_SetGLUerror(code);
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
%}
%name(gluBuild1DMipmapLevels) PyObject* _gluBuild1DMipmapLevels(GLenum target, GLint components, GLint width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *buffer);
DOC(gluBuild1DMipmapLevels, "gluBuild1DMipmapLevels(target, components, width, format, type, level, base, max, data) -> None")
%{
PyObject *__gluBuild1DMipmapLevels(GLenum target, GLint components, GLint width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *buffer)
{
int code;
SetupPixelWrite(1);
code = gluBuild1DMipmapLevels(target, components, width, format, type, level, base, max, buffer);
if (code)
{
PyErr_SetGLUerror(code);
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
%}
%name(gluBuild1DMipmapLevelsb) PyObject *__gluBuild1DMipmapLevels(GLenum target, GLint components, GLint d_5_0, GLenum format, GLenum type_BYTE, GLint level, GLint base, GLint max, const GLbyte *buffer);
DOC(gluBuild1DMipmapLevelsb, "gluBuild1DMipmapLevelsb(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild1DMipmapLevelsub) PyObject *__gluBuild1DMipmapLevels(GLenum target, GLint components, GLint d_5_0, GLenum format, GLenum type_UNSIGNED_BYTE, GLint level, GLint base, GLint max, const GLubyte *buffer);
DOC(gluBuild1DMipmapLevelsub, "gluBuild1DMipmapLevelsub(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild1DMipmapLevelss) PyObject *__gluBuild1DMipmapLevels(GLenum target, GLint components, GLint d_5_0, GLenum format, GLenum type_SHORT, GLint level, GLint base, GLint max, const GLshort *buffer);
DOC(gluBuild1DMipmapLevelss, "gluBuild1DMipmapLevelss(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild1DMipmapLevelsus) PyObject *__gluBuild1DMipmapLevels(GLenum target, GLint components, GLint d_5_0, GLenum format, GLenum type_UNSIGNED_SHORT, GLint level, GLint base, GLint max, const GLushort *buffer);
DOC(gluBuild1DMipmapLevelsus, "gluBuild1DMipmapLevelsus(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild1DMipmapLevelsi) PyObject *__gluBuild1DMipmapLevels(GLenum target, GLint components, GLint d_5_0, GLenum format, GLenum type_INT, GLint level, GLint base, GLint max, const GLint *buffer);
DOC(gluBuild1DMipmapLevelsi, "gluBuild1DMipmapLevelsi(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild1DMipmapLevelsui) PyObject *__gluBuild1DMipmapLevels(GLenum target, GLint components, GLint d_5_0, GLenum format, GLenum type_UNSIGNED_INT, GLint level, GLint base, GLint max, const GLuint *buffer);
DOC(gluBuild1DMipmapLevelsui, "gluBuild1DMipmapLevelsui(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild1DMipmapLevelsf) PyObject *__gluBuild1DMipmapLevels(GLenum target, GLint components, GLint d_5_0, GLenum format, GLenum type_FLOAT, GLint level, GLint base, GLint max, const GLshort *buffer);
DOC(gluBuild1DMipmapLevelsf, "gluBuild1DMipmapLevelsf(target, components, format, level, base, max, pixels) -> None")
/*int gluBuild2DMipmapLevels(GLenum target, GLint components, GLint width, GLint height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data); */
%{
PyObject* _gluBuild2DMipmapLevels(GLenum target, GLint components, GLint width, GLint height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *buffer)
{
int code;
code = gluBuild2DMipmapLevels(target, components, width, height, format, type, level, base, max, buffer);
if (code)
{
PyErr_SetGLUerror(code);
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
%}
%name(gluBuild2DMipmapLevels) PyObject* _gluBuild2DMipmapLevels(GLenum target, GLint components, GLint width, GLint height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *buffer);
DOC(gluBuild2DMipmapLevels, "gluBuild2DMipmapLevels(target, components, width, height, format, type, level, base, max, data) -> None")
%{
PyObject *__gluBuild2DMipmapLevels(GLenum target, GLint components, GLint width, GLint height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *buffer)
{
int code;
SetupPixelWrite(2);
code = gluBuild2DMipmapLevels(target, components, width, height, format, type, level, base, max, buffer);
if (code)
{
PyErr_SetGLUerror(code);
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
%}
%name(gluBuild2DMipmapLevelsb) PyObject *__gluBuild2DMipmapLevels(GLenum target, GLint components, GLint d_9_1, GLint d_9_0, GLenum format, GLenum type_BYTE, GLint level, GLint base, GLint max, const GLbyte *buffer);
DOC(gluBuild2DMipmapLevelsb, "gluBuild2DMipmapLevelsb(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild2DMipmapLevelsub) PyObject *__gluBuild2DMipmapLevels(GLenum target, GLint components, GLint d_9_1, GLint d_9_0, GLenum format, GLenum type_UNSIGNED_BYTE, GLint level, GLint base, GLint max, const GLubyte *buffer);
DOC(gluBuild2DMipmapLevelsub, "gluBuild2DMipmapLevelsub(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild2DMipmapLevelss) PyObject *__gluBuild2DMipmapLevels(GLenum target, GLint components, GLint d_9_1, GLint d_9_0, GLenum format, GLenum type_SHORT, GLint level, GLint base, GLint max, const GLshort *buffer);
DOC(gluBuild2DMipmapLevelss, "gluBuild2DMipmapLevelss(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild2DMipmapLevelsus) PyObject *__gluBuild2DMipmapLevels(GLenum target, GLint components, GLint d_9_1, GLint d_9_0, GLenum format, GLenum type_UNSIGNED_SHORT, GLint level, GLint base, GLint max, const GLushort *buffer);
DOC(gluBuild2DMipmapLevelsus, "gluBuild2DMipmapLevelsus(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild2DMipmapLevelsi) PyObject *__gluBuild2DMipmapLevels(GLenum target, GLint components, GLint d_9_1, GLint d_9_0, GLenum format, GLenum type_INT, GLint level, GLint base, GLint max, const GLint *buffer);
DOC(gluBuild2DMipmapLevelsi, "gluBuild2DMipmapLevelsi(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild2DMipmapLevelsui) PyObject *__gluBuild2DMipmapLevels(GLenum target, GLint components, GLint d_9_1, GLint d_9_0, GLenum format, GLenum type_UNSIGNED_INT, GLint level, GLint base, GLint max, const GLuint *buffer);
DOC(gluBuild2DMipmapLevelsui, "gluBuild2DMipmapLevelsui(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild2DMipmapLevelsf) PyObject *__gluBuild2DMipmapLevels(GLenum target, GLint components, GLint d_9_1, GLint d_9_0, GLenum format, GLenum type_FLOAT, GLint level, GLint base, GLint max, const GLshort *buffer);
DOC(gluBuild2DMipmapLevelsf, "gluBuild2DMipmapLevelsf(target, components, format, level, base, max, pixels) -> None")
/*int gluBuild3DMipmapLevels(GLenum target, GLint components, GLint width, GLint height, GLint depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data); */
%{
PyObject* _gluBuild3DMipmapLevels(GLenum target, GLint components, GLint width, GLint height, GLint depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *buffer)
{
int code;
code = gluBuild3DMipmapLevels(target, components, width, height, depth, format, type, level, base, max, buffer);
if (code)
{
PyErr_SetGLUerror(code);
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
%}
%name(gluBuild3DMipmapLevels) PyObject* _gluBuild3DMipmapLevels(GLenum target, GLint components, GLint width, GLint height, GLint depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *buffer);
DOC(gluBuild3DMipmapLevels, "gluBuild3DMipmapLevels(target, components, width, height, depth, format, type, level, base, max, data) -> None")
%{
PyObject *__gluBuild3DMipmapLevels(GLenum target, GLint components, GLint width, GLint height, GLint depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *buffer)
{
int code;
SetupPixelWrite(2);
code = gluBuild3DMipmapLevels(target, components, width, height, depth, format, type, level, base, max, buffer);
if (code)
{
PyErr_SetGLUerror(code);
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
%}
%name(gluBuild3DMipmapLevelsb) PyObject *__gluBuild3DMipmapLevels(GLenum target, GLint components, GLint d_9_2, GLint d_9_1, GLint d_9_0, GLenum format, GLenum type_BYTE, GLint level, GLint base, GLint max, const GLbyte *buffer);
DOC(gluBuild3DMipmapLevelsb, "gluBuild3DMipmapLevelsb(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild3DMipmapLevelsub) PyObject *__gluBuild3DMipmapLevels(GLenum target, GLint components, GLint d_9_2, GLint d_9_1, GLint d_9_0, GLenum format, GLenum type_UNSIGNED_BYTE, GLint level, GLint base, GLint max, const GLubyte *buffer);
DOC(gluBuild3DMipmapLevelsub, "gluBuild3DMipmapLevelsub(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild3DMipmapLevelss) PyObject *__gluBuild3DMipmapLevels(GLenum target, GLint components, GLint d_9_2, GLint d_9_1, GLint d_9_0, GLenum format, GLenum type_SHORT, GLint level, GLint base, GLint max, const GLshort *buffer);
DOC(gluBuild3DMipmapLevelss, "gluBuild3DMipmapLevelss(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild3DMipmapLevelsus) PyObject *__gluBuild3DMipmapLevels(GLenum target, GLint components, GLint d_9_2, GLint d_9_1, GLint d_9_0, GLenum format, GLenum type_UNSIGNED_SHORT, GLint level, GLint base, GLint max, const GLushort *buffer);
DOC(gluBuild3DMipmapLevelsus, "gluBuild3DMipmapLevelsus(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild3DMipmapLevelsi) PyObject *__gluBuild3DMipmapLevels(GLenum target, GLint components, GLint d_9_2, GLint d_9_1, GLint d_9_0, GLenum format, GLenum type_INT, GLint level, GLint base, GLint max, const GLint *buffer);
DOC(gluBuild3DMipmapLevelsi, "gluBuild3DMipmapLevelsi(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild3DMipmapLevelsui) PyObject *__gluBuild3DMipmapLevels(GLenum target, GLint components, GLint d_9_2, GLint d_9_1, GLint d_9_0, GLenum format, GLenum type_UNSIGNED_INT, GLint level, GLint base, GLint max, const GLuint *buffer);
DOC(gluBuild3DMipmapLevelsui, "gluBuild3DMipmapLevelsui(target, components, format, level, base, max, pixels) -> None")
%name(gluBuild3DMipmapLevelsf) PyObject *__gluBuild3DMipmapLevels(GLenum target, GLint components, GLint d_9_2, GLint d_9_1, GLint d_9_0, GLenum format, GLenum type_FLOAT, GLint level, GLint base, GLint max, const GLshort *buffer);
DOC(gluBuild3DMipmapLevelsf, "gluBuild3DMipmapLevelsf(target, components, format, level, base, max, pixels) -> None")
#endif
%{
void CALLBACK throwGLUerror(GLenum code)
{
PyErr_SetGLUerror(code);
}
%}
%{
typedef struct
{
PyObject_HEAD
GLUquadric *obj;
PyObject *begin, *beginData, *edgeFlag, *edgeFlagData, *vertex, *vertexData;
PyObject *end, *endData, *combine, *combineData;
} PyGLUquadric;
PyGLUquadric *currentQuadric = NULL;
static void PyGLUquadric_Del(PyObject *self)
{
gluDeleteQuadric(((PyGLUquadric*)self)->obj);
PyObject_Del(self);
}
PyTypeObject PyGLUquadric_Type =
{
PyObject_HEAD_INIT(0)
0, /* ob_size */
"GLUquadric", /* tp_name */
sizeof(PyGLUquadric), /* tp_basicsize */
0, /* tp_itemsize */
PyGLUquadric_Del, /* tp_dealloc */
};
#define PYOBJ(x) ((x) ? (PyObject*)x : Py_None)
PyGLUquadric* _gluNewQuadric()
{
PyGLUquadric *self = PyObject_NEW(PyGLUquadric, &PyGLUquadric_Type);
if (!(self->obj = gluNewQuadric()))
{
PyErr_SetGLUerror(GLU_OUT_OF_MEMORY);
return NULL;
}
gluQuadricCallback(self->obj, GLU_ERROR, throwGLUerror);
return self;
}
PyObject* _gluQuadricCallback(PyGLUquadric* self, GLenum which, PyObject* pyfunc)
{
PyErr_SetString(PyExc_Exception, "Can't set that callback.");
return NULL;
}
%}
%typemap(python,in) PyGLUquadric*
{
if ($input->ob_type != &PyGLUquadric_Type)
{
PyErr_SetString(PyExc_Exception, "Not a GLUquadric object.");
return NULL;
}
$1 = currentQuadric = (PyGLUquadric*)$input;
}
%typemap(python,freearg) PyGLUquadric*, GLUquadric*
{
currentQuadric = NULL;
if (PyErr_Occurred()) return NULL;
}
%typemap(python,out) PyGLUquadric*
{
$result = (PyObject*)$1;
}
%typemap(python,in) GLUquadric*
{
if ($input->ob_type != &PyGLUquadric_Type)
{
PyErr_SetString(PyExc_Exception, "Not a GLUquadric object.");
return NULL;
}
currentQuadric = (PyGLUquadric*)$input;
$1 = currentQuadric->obj;
}
/*GLUquadric* gluNewQuadric (void); */
%name(gluNewQuadric) PyGLUquadric* _gluNewQuadric();
DOC(gluNewQuadric, "gluNewQuadric() -> GLUquadric")
%name(gluDeleteQuadric) void __ignoreDeletionCall(PyObject *quadObject);
DOC(gluDeleteQuadric, "gluDeleteQuadric(quadObject) -> (null function, use del nobj instead)")
void gluQuadricNormals(GLUquadric *quadObject, GLenum normals);
DOC(gluQuadricNormals, "gluQuadricNormals(quadObject, normals) -> None")
void gluQuadricTexture(GLUquadric *quadObject, GLboolean textureCoords);
DOC(gluQuadricTexture, "gluQuadricTexture(quadObject, textureCoords) -> None")
void gluQuadricOrientation(GLUquadric *quadObject, GLenum orientation);
DOC(gluQuadricOrientation, "gluQuadricOrientation(quadObject, orientation) -> None")
void gluQuadricDrawStyle(GLUquadric *quadObject, GLenum drawStyle);
DOC(gluQuadricDrawStyle, "gluQuadricDrawStyle(quadObject, drawStyle) -> None")
void gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius, GLdouble height, GLint slices, GLint stacks);
DOC(gluCylinder, "gluCylinder(qobj, baseRadius, topRadius, height, slices, stacks) -> None")
void gluDisk(GLUquadric *qobj, GLdouble innerRadius, GLdouble outerRadius, GLint slices, GLint loops);
DOC(gluDisk, "gluDisk(qobj, innerRadius, outerRadius, slices, loops) -> None")
void gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius, GLdouble outerRadius, GLint slices, GLint loops, GLdouble startAngle, GLdouble sweepAngle);
DOC(gluPartialDisk, "gluPartialDisk(qobj, innerRadius, outerRadius, slices, loops, startAngle, sweepAngle) -> None")
void gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks);
DOC(gluSphere, "gluSphere(qobj, radius, slices, stacks) -> None")
/*void gluQuadricCallback(GLUquadric *qobj, GLenum which, void (CALLBACK* pyfunc)()); */
%name(gluQuadricCallback) PyObject* _gluQuadricCallback(PyGLUquadric* self, GLenum which, PyObject* pyfunc);
DOC(gluQuadricCallback, "gluQuadricCallback(qobj, which, func)")
%{
#ifndef GLU_VERSION_1_2
#define GLU_TESS_BEGIN 100100
#define GLU_TESS_VERTEX 100101
#define GLU_TESS_END 100102
#define GLU_TESS_ERROR 100103
#define GLU_TESS_EDGE_FLAG 100104
#define GLU_TESS_COMBINE 100105
#define GLU_TESS_BEGIN_DATA 100106
#define GLU_TESS_VERTEX_DATA 100107
#define GLU_TESS_END_DATA 100108
#define GLU_TESS_ERROR_DATA 100109
#define GLU_TESS_EDGE_FLAG_DATA 100110
#define GLU_TESS_COMBINE_DATA 100111
#endif
typedef struct
{
PyObject_HEAD
GLUtesselator *obj;
PyObject *lockedObjects;
PyObject *callbacks;
PyObject *currentData;
} PyGLUtesselator;
static void PyGLUtesselator_Del(PyObject *self)
{
gluDeleteTess(((PyGLUtesselator*)self)->obj);
Py_DECREF(((PyGLUtesselator*)self)->lockedObjects);
Py_DECREF(((PyGLUtesselator*)self)->callbacks);
if (((PyGLUtesselator*)self)->currentData) {
Py_DECREF(((PyGLUtesselator*)self)->currentData);
}
PyObject_Del(self);
}
PyTypeObject PyGLUtesselator_Type =
{
PyObject_HEAD_INIT(0)
0, /* ob_size */
"GLUtesselator", /* tp_name */
sizeof(PyGLUtesselator), /* tp_basicsize */
0, /* tp_itemsize */
PyGLUtesselator_Del, /* tp_dealloc */
};
#define PYOBJ(x) ((x) ? (PyObject*)x : Py_None)
PyObject *GetTessCallback( void * currentTessellator, char *name)
{
if (currentTessellator) {
PyGLUtesselator * tess = (PyGLUtesselator *) ((PyObject *) currentTessellator);
{
PyObject *this_callback = PyDict_GetItemString(tess->callbacks, name);
if (this_callback != Py_None) return this_callback;
}
}
return NULL;
}
PyObject *GetTessData( void * currentTessellator)
{
if (currentTessellator) {
PyGLUtesselator * tess = (PyGLUtesselator *) ((PyObject *) currentTessellator);
return tess->currentData;
}
return NULL;
}
void CALLBACK PyGLUtesselator_begin(GLenum type, void *polygon_data)
{
/* callback when Python code has only specified begin */
PyObject *this_callback = GetTessCallback( polygon_data, "begin");
if (this_callback)
{
PyObject *result = PyObject_CallFunction(this_callback, "l", (long)type);
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUtesselator_beginData(GLenum type, void *polygon_data)
{
/* callback when Python code has only specified begindata */
PyObject *this_callback = GetTessCallback( polygon_data, "beginData");
if (this_callback)
{
PyObject * data = GetTessData( polygon_data );
PyObject *result = PyObject_CallFunction(this_callback, "lO", (long)type, data);
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUtesselator_edgeFlag(GLboolean flag, void *polygon_data)
{
PyObject *this_callback = GetTessCallback( polygon_data, "edgeFlag");
if (this_callback)
{
PyObject *result = PyObject_CallFunction(this_callback, "l", (long)flag);
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUtesselator_edgeFlagData(GLboolean flag, void *polygon_data)
{
PyObject *this_callback = GetTessCallback( polygon_data, "edgeFlagData");
if (this_callback)
{
PyObject * data = GetTessData( polygon_data );
PyObject *result = PyObject_CallFunction(this_callback, "lO", (long)flag, data);
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUtesselator_vertex(void *vertex_data, void *polygon_data)
{
PyObject *this_callback = GetTessCallback( polygon_data, "vertex");
if (this_callback)
{
PyObject *result = PyObject_CallFunction(this_callback, "(O)", PYOBJ(vertex_data));
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUtesselator_vertexData(void *vertex_data, void *polygon_data)
{
PyObject *this_callback = GetTessCallback( polygon_data, "vertexData");
if (this_callback)
{
PyObject * data = GetTessData( polygon_data );
PyObject *result = PyObject_CallFunction(this_callback, "OO", PYOBJ(vertex_data), data);
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUtesselator_end(void *polygon_data)
{
PyObject *this_callback = GetTessCallback( polygon_data, "end");
if (this_callback)
{
PyObject *result = PyObject_CallFunction(this_callback, NULL);
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUtesselator_endData(void *polygon_data)
{
PyObject *this_callback = GetTessCallback( polygon_data, "endData");
if (this_callback)
{
PyObject * data = GetTessData( polygon_data );
PyObject *result = PyObject_CallFunction(this_callback, "(O)", data);
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUtesselator_combine(GLdouble coords[3], void *vertex_data[4], GLfloat weight[4], void **outData, void *polygon_data)
{
PyObject *this_callback = GetTessCallback( polygon_data, "combine");
if (this_callback)
{
PyObject *result = NULL;
result = PyObject_CallFunction(this_callback,
"(ddd)(OOOO)(ffff)",
coords[0], coords[1], coords[2],
PYOBJ(vertex_data[0]), PYOBJ(vertex_data[1]), PYOBJ(vertex_data[2]), PYOBJ(vertex_data[3]),
weight[0], weight[1], weight[2], weight[3]);
if (result)
{
PyList_Append(
((PyGLUtesselator *) ((PyObject *) polygon_data))->lockedObjects,
result
);
*outData = (void*)result;
Py_DECREF(result);
}
PyErr_XPrint();
}
}
void CALLBACK PyGLUtesselator_combineData(GLdouble coords[3], void *vertex_data[4], GLfloat weight[4], void **outData, void *polygon_data)
{
PyObject *this_callback = GetTessCallback( polygon_data, "combineData");
if (this_callback)
{
PyObject * data = GetTessData( polygon_data );
PyObject *result = PyObject_CallFunction(this_callback,
"(ddd)(OOOO)(ffff)O",
coords[0], coords[1], coords[2],
PYOBJ(vertex_data[0]), PYOBJ(vertex_data[1]), PYOBJ(vertex_data[2]), PYOBJ(vertex_data[3]),
weight[0], weight[1], weight[2], weight[3],
data);
if (result)
{
PyList_Append(
((PyGLUtesselator *) ((PyObject *) polygon_data))->lockedObjects,
result
);
*outData = (void*)result;
Py_DECREF(result);
}
PyErr_XPrint();
}
}
void CALLBACK tess_throwGLUerror(GLenum code, void *polygon_data)
{
PyErr_SetObject(GLUerror, Py_BuildValue("isO", code, gluErrorString(code), PYOBJ(polygon_data)));
}
PyGLUtesselator* _gluNewTess()
{
PyGLUtesselator *self = PyObject_NEW(PyGLUtesselator, &PyGLUtesselator_Type);
if (!(self->obj = gluNewTess()))
{
PyErr_SetGLUerror(GLU_OUT_OF_MEMORY);
return NULL;
}
gluTessCallback(self->obj, GLU_TESS_ERROR_DATA, tess_throwGLUerror);
self->lockedObjects = PyList_New(0);
self->callbacks = PyDict_New();
self->currentData = Py_None;
Py_INCREF( self->currentData );
return self;
}
#define SET_TESS_CALLBACK(NAME,TYPE)\
PyDict_SetItemString(self->callbacks, #NAME, pyfunc);\
gluTessCallback(self->obj, TYPE, (pyfunc == Py_None) ? NULL : (callback)PyGLUtesselator_##NAME);
PyObject* _gluTessCallback(PyGLUtesselator* self, GLenum which, PyObject* pyfunc)
{
switch (which)
{
case GLU_TESS_BEGIN:
SET_TESS_CALLBACK(begin,GLU_TESS_BEGIN_DATA)
break;
case GLU_TESS_BEGIN_DATA:
SET_TESS_CALLBACK(beginData,GLU_TESS_BEGIN_DATA)
break;
case GLU_TESS_EDGE_FLAG:
SET_TESS_CALLBACK(edgeFlag,GLU_TESS_EDGE_FLAG_DATA)
break;
case GLU_TESS_EDGE_FLAG_DATA:
SET_TESS_CALLBACK(edgeFlagData,GLU_TESS_EDGE_FLAG_DATA)
break;
case GLU_TESS_VERTEX:
SET_TESS_CALLBACK(vertex,GLU_TESS_VERTEX_DATA)
break;
case GLU_TESS_VERTEX_DATA:
SET_TESS_CALLBACK(vertexData,GLU_TESS_VERTEX_DATA)
break;
case GLU_TESS_END:
SET_TESS_CALLBACK(end,GLU_TESS_END_DATA)
break;
case GLU_TESS_END_DATA:
SET_TESS_CALLBACK(endData,GLU_TESS_END_DATA)
break;
case GLU_TESS_COMBINE:
SET_TESS_CALLBACK(combine,GLU_TESS_COMBINE_DATA)
break;
case GLU_TESS_COMBINE_DATA:
SET_TESS_CALLBACK(combineData,GLU_TESS_COMBINE_DATA)
break;
case GLU_TESS_ERROR:
case GLU_TESS_ERROR_DATA:
PyErr_SetString(PyExc_Exception, "Can't set that callback.");
return NULL;
default:
PyErr_SetString(PyExc_Exception, "Unknown callback code.");
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
%}
%typemap(python,in) PyGLUtesselator*
{
if ($input->ob_type != &PyGLUtesselator_Type)
{
PyErr_SetString(PyExc_Exception, "Not a GLUtesselator object.");
return NULL;
}
$1 = (PyGLUtesselator*)$input;
}
%typemap(python,freearg) PyGLUtesselator*, GLUtesselator*
{
/*currentTesselator = NULL;*/
if (PyErr_Occurred()) return NULL;
}
%typemap(python,out) PyGLUtesselator*
{
$result = (PyObject*)$1;
}
%typemap(python,in) GLUtesselator*
{
if ($input->ob_type != &PyGLUtesselator_Type)
{
PyErr_SetString(PyExc_Exception, "Not a GLUtesselator object.");
return NULL;
}
/*currentTesselator = (PyGLUtesselator*)$input;*/
$1 = ((PyGLUtesselator*)$input)->obj;
}
/*GLUtesselator* gluNewTess(); */
%name(gluNewTess) PyGLUtesselator* _gluNewTess();
DOC(gluNewTess, "gluNewTess() -> GLUtesselator")
/*void gluDeleteTess(GLUtesselator *tess); */
%name(gluDeleteTess) void __ignoreDeletionCall(PyObject *tess);
DOC(gluDeleteTess, "gluDeleteTess(tess) -> (null function, use del tess instead)")
#if API_VERSION >= 258
%{
void _gluTessBeginPolygon(PyGLUtesselator *self, PyObject *polygon_data)
{
PyList_Append(self->lockedObjects, polygon_data);
if (self->currentData) {
Py_DECREF( self->currentData);
}
self->currentData = polygon_data;
Py_INCREF( polygon_data );
gluTessBeginPolygon(self->obj, (void*)self);
}
%}
%name(gluTessBeginPolygon) void _gluTessBeginPolygon(PyGLUtesselator *self, PyObject *polygon_data);
DOC(gluTessBeginPolygon, "gluTessBeginPolygon(tess, polygon_data) -> None")
#endif
void gluBeginPolygon(GLUtesselator *tess);
DOC(gluBeginPolygon, "gluBeginPolygon(tess) -> None")
#if API_VERSION >= 258
void gluTessBeginContour(GLUtesselator *tess);
DOC(gluTessBeginContour, "gluTessBeginContour(tess) -> None")
#endif
%{
void _gluTessVertex(PyGLUtesselator *self, const GLdouble *coords, PyObject *data)
{
PyList_Append(self->lockedObjects, data);
gluTessVertex(self->obj, (GLdouble*)coords, (void*)data);
}
%}
%name(gluTessVertex) void _gluTessVertex(PyGLUtesselator *tess, const GLdouble *coords, PyObject *data);
DOC(gluTessVertex, "gluTessVertex(tess, coords, data) -> None")
/* Backwards compatibility for old tesselator */
#if API_VERSION >= 258
void gluTessEndContour(GLUtesselator *tess);
DOC(gluTessEndContour, "gluTessEndContour(tess) -> None")
#endif
void gluNextContour(GLUtesselator *tess, GLenum type);
DOC(gluNextContour, "gluNextContour(tess, type) -> None")
#if API_VERSION >= 258
%{
void _gluTessEndPolygon(PyGLUtesselator *self)
{
gluTessEndPolygon(self->obj);
PySequence_DelSlice(self->lockedObjects, 0, -1);
}
%}
%name(gluTessEndPolygon) void _gluTessEndPolygon(PyGLUtesselator *self);
DOC(gluTessEndPolygon, "gluTessEndPolygon(tess) -> None")
#endif
void gluEndPolygon(GLUtesselator *tess);
DOC(gluEndPolygon, "gluEndPolygon(tess) -> None")
#if API_VERSION >= 258
void gluTessProperty(GLUtesselator *tess, GLenum which, GLdouble value);
DOC(gluTessProperty, "gluTessProperty(tess, which, value) -> None")
#endif
#if API_VERSION >= 258
void gluTessNormal(GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z);
DOC(gluTessNormal, "gluTessNormal(tess, x, y, z) -> None")
#endif
/*void gluTessCallback(GLUtesselator *tess, GLenum which, void (CALLBACK *pyfunc)()); */
%name(gluTessCallback) PyObject* _gluTessCallback(PyGLUtesselator* self, GLenum which, PyObject* pyfunc);
DOC(gluTessCallback, "gluTessCallback(tess, which, pyfunc) -> None\n\
\n\
The error callbacks GLU_TESS_ERROR and GLU_TESS_ERROR_BEGIN cannot be set by\n\
gluTessCallback, instead an exception is thrown when an error occurs with the\n\
exception value set to a tuple (errno, polygon_data)")
#if API_VERSION >= 258
void gluGetTessProperty(GLUtesselator *tess, GLenum which, GLdouble value[1]);
DOC(gluGetTessProperty, "gluGetTessProperty(tess, which) -> value")
#endif
%{
#ifndef GLU_VERSION_1_3
#define GLU_NURBS_MODE 100160
#define GLU_NURBS_TESSELLATOR 100161
#define GLU_NURBS_RENDERER 100162
#define GLU_NURBS_BEGIN 100164
#define GLU_NURBS_VERTEX 100165
#define GLU_NURBS_NORMAL 100166
#define GLU_NURBS_COLOR 100167
#define GLU_NURBS_TEXTURE_COORD 100168
#define GLU_NURBS_END 100169
#define GLU_NURBS_BEGIN_DATA 100170
#define GLU_NURBS_VERTEX_DATA 100171
#define GLU_NURBS_NORMAL_DATA 100172
#define GLU_NURBS_COLOR_DATA 100173
#define GLU_NURBS_TEXTURE_COORD_DATA 100174
#define GLU_NURBS_END_DATA 100175
#endif
typedef struct
{
PyObject_HEAD
GLUnurbs *obj;
PyObject *data;
PyObject *callbacks;
} PyGLUnurbs;
PyGLUnurbs *currentNurbs = NULL;
static void PyGLUnurbs_Del(PyObject *self)
{
gluDeleteNurbsRenderer(((PyGLUnurbs*)self)->obj);
Py_DECREF(((PyGLUnurbs*)self)->data);
Py_DECREF(((PyGLUtesselator*)self)->callbacks);
PyObject_Del(self);
}
PyTypeObject PyGLUnurbs_Type =
{
PyObject_HEAD_INIT(0)
0, /* ob_size */
"GLUnurbs", /* tp_name */
sizeof(PyGLUnurbs), /* tp_basicsize */
0, /* tp_itemsize */
PyGLUnurbs_Del, /* tp_dealloc */
};
#define PYOBJ(x) ((x) ? (PyObject*)x : Py_None)
PyObject *GetNurbsCallback(char *name)
{
if (currentNurbs)
{
PyObject *this_callback = PyDict_GetItemString(currentNurbs->callbacks, name);
if (this_callback != Py_None) return this_callback;
}
return NULL;
}
PyGLUnurbs* _gluNewNurbsRenderer()
{
PyGLUnurbs *self = PyObject_NEW(PyGLUnurbs, &PyGLUnurbs_Type);
if (!(self->obj = gluNewNurbsRenderer()))
{
PyErr_SetGLUerror(GLU_OUT_OF_MEMORY);
return NULL;
}
gluNurbsCallback(self->obj, GLU_ERROR, throwGLUerror);
Py_INCREF(self->data = Py_None);
self->callbacks = PyDict_New();
return self;
}
void CALLBACK PyGLUnurbs_begin(GLenum type)
{
PyObject *this_callback = GetNurbsCallback("begin");
if (this_callback)
{
PyObject *result = PyObject_CallFunction(this_callback, "l", (long)type);
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUnurbs_beginData(GLenum type, void *userData)
{
PyObject *this_callback = GetNurbsCallback("beginData");
if (this_callback)
{
PyObject *result = PyObject_CallFunction(this_callback, "lO", (long)type, PYOBJ(userData));
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUnurbs_vertex(GLfloat *vertex)
{
PyObject *this_callback = GetNurbsCallback("vertex");
if (this_callback)
{
PyObject *result = PyObject_CallFunction(this_callback, "(fff)", vertex[0], vertex[1], vertex[2]);
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUnurbs_vertexData(GLfloat *vertex, void *userData)
{
PyObject *this_callback = GetNurbsCallback("vertexData");
if (this_callback)
{
PyObject *result = PyObject_CallFunction(this_callback, "(fff)O", vertex[0], vertex[1], vertex[2], PYOBJ(userData));
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUnurbs_normal(GLfloat *normal)
{
PyObject *this_callback = GetNurbsCallback("normal");
if (this_callback)
{
PyObject *result = PyObject_CallFunction(this_callback, "(fff)", normal[0], normal[1], normal[2]);
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUnurbs_normalData(GLfloat *normal, void *userData)
{
PyObject *this_callback = GetNurbsCallback("normalData");
if (this_callback)
{
PyObject *result = PyObject_CallFunction(this_callback, "(fff)O", normal[0], normal[1], normal[2], PYOBJ(userData));
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUnurbs_color(GLfloat *color)
{
PyObject *this_callback = GetNurbsCallback("color");
if (this_callback)
{
PyObject *result = PyObject_CallFunction(this_callback, "(ffff)", color[0], color[1], color[2], color[3]);
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUnurbs_colorData(GLfloat *color, void *userData)
{
PyObject *this_callback = GetNurbsCallback("colorData");
if (this_callback)
{
PyObject *result = PyObject_CallFunction(this_callback, "(ffff)O", color[0], color[1], color[2], color[3], PYOBJ(userData));
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUnurbs_texCoord(GLfloat *texCoord)
{
PyObject *this_callback = GetNurbsCallback("texCoord");
if (this_callback)
{
PyObject *result = NULL;
if (glIsEnabled(GL_MAP1_TEXTURE_COORD_1) || glIsEnabled(GL_MAP2_TEXTURE_COORD_1))
{
result = PyObject_CallFunction(this_callback, "((f))", texCoord[0]);
}
else if (glIsEnabled(GL_MAP1_TEXTURE_COORD_2) || glIsEnabled(GL_MAP2_TEXTURE_COORD_2))
{
result = PyObject_CallFunction(this_callback, "(ff)", texCoord[0], texCoord[1]);
}
else if (glIsEnabled(GL_MAP1_TEXTURE_COORD_3) || glIsEnabled(GL_MAP2_TEXTURE_COORD_3))
{
result = PyObject_CallFunction(this_callback, "(fff)", texCoord[0], texCoord[1], texCoord[2]);
}
else if (glIsEnabled(GL_MAP1_TEXTURE_COORD_4) || glIsEnabled(GL_MAP2_TEXTURE_COORD_4))
{
result = PyObject_CallFunction(this_callback, "(ffff)", texCoord[0], texCoord[1], texCoord[2], texCoord[3]);
}
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUnurbs_texCoordData(GLfloat *texCoord, void *userData)
{
PyObject *this_callback = GetNurbsCallback("texCoordData");
if (this_callback)
{
PyObject *result = NULL;
if (glIsEnabled(GL_MAP1_TEXTURE_COORD_1) || glIsEnabled(GL_MAP2_TEXTURE_COORD_1))
{
result = PyObject_CallFunction(this_callback, "(f)O", texCoord[0], PYOBJ(userData));
}
else if (glIsEnabled(GL_MAP1_TEXTURE_COORD_2) || glIsEnabled(GL_MAP2_TEXTURE_COORD_2))
{
result = PyObject_CallFunction(this_callback, "(ff)O", texCoord[0], texCoord[1], PYOBJ(userData));
}
else if (glIsEnabled(GL_MAP1_TEXTURE_COORD_3) || glIsEnabled(GL_MAP2_TEXTURE_COORD_3))
{
result = PyObject_CallFunction(this_callback, "(fff)O", texCoord[0], texCoord[1], texCoord[2], PYOBJ(userData));
}
else if (glIsEnabled(GL_MAP1_TEXTURE_COORD_4) || glIsEnabled(GL_MAP2_TEXTURE_COORD_4))
{
result = PyObject_CallFunction(this_callback, "(ffff)O", texCoord[0], texCoord[1], texCoord[2], texCoord[3], PYOBJ(userData));
}
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUnurbs_end()
{
PyObject *this_callback = GetNurbsCallback("end");
if (this_callback)
{
PyObject *result = PyObject_CallFunction(this_callback, NULL);
Py_XDECREF(result);
PyErr_XPrint();
}
}
void CALLBACK PyGLUnurbs_endData(void *userData)
{
PyObject *this_callback = GetNurbsCallback("endData");
if (this_callback)
{
PyObject *result = PyObject_CallFunction(this_callback, "O", PYOBJ(userData));
Py_XDECREF(result);
PyErr_XPrint();
}
}
#define SET_NURBS_CALLBACK(NAME)\
PyDict_SetItemString(self->callbacks, #NAME, pyfunc);\
gluNurbsCallback(self->obj, which, (pyfunc == Py_None) ? NULL : (callback)PyGLUnurbs_##NAME);
PyObject* _gluNurbsCallback(PyGLUnurbs* self, GLenum which, PyObject* pyfunc)
{
switch (which)
{
case GLU_NURBS_BEGIN:
SET_NURBS_CALLBACK(begin)
break;
case GLU_NURBS_BEGIN_DATA:
SET_NURBS_CALLBACK(beginData)
break;
case GLU_NURBS_VERTEX:
SET_NURBS_CALLBACK(vertex)
break;
case GLU_NURBS_VERTEX_DATA:
SET_NURBS_CALLBACK(vertexData)
break;
case GLU_NURBS_NORMAL:
SET_NURBS_CALLBACK(normal)
break;
case GLU_NURBS_NORMAL_DATA:
SET_NURBS_CALLBACK(normalData)
break;
case GLU_NURBS_COLOR:
SET_NURBS_CALLBACK(color)
break;
case GLU_NURBS_COLOR_DATA:
SET_NURBS_CALLBACK(colorData)
break;
case GLU_NURBS_TEXTURE_COORD:
SET_NURBS_CALLBACK(texCoord)
break;
case GLU_NURBS_TEXTURE_COORD_DATA:
SET_NURBS_CALLBACK(texCoordData)
break;
case GLU_NURBS_END:
SET_NURBS_CALLBACK(end)
break;
case GLU_NURBS_END_DATA:
SET_NURBS_CALLBACK(endData)
break;
case GLU_ERROR:
PyErr_SetString(PyExc_Exception, "Can't set that callback.");
return NULL;
default:
PyErr_SetString(PyExc_Exception, "Unknown callback code.");
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
%}
%typemap(python,in) PyGLUnurbs*
{
if ($input->ob_type != &PyGLUnurbs_Type)
{
PyErr_SetString(PyExc_Exception, "Not a GLUnurbs object.");
return NULL;
}
$1 = currentNurbs = (PyGLUnurbs*)$input;
}
%typemap(python,freearg) PyGLUnurbs*, GLUnurbs*
{
currentNurbs = NULL;
if (PyErr_Occurred()) return NULL;
}
%typemap(python,out) PyGLUnurbs*
{
$result = (PyObject*)$1;
}
%typemap(python,in) GLUnurbs*
{
if ($input->ob_type != &PyGLUnurbs_Type)
{
PyErr_SetString(PyExc_Exception, "Not a GLUnurbs object.");
return NULL;
}
currentNurbs = (PyGLUnurbs*)$input;
$1 = currentNurbs->obj;
}
/*GLUnurbs* gluNewNurbsRenderer(); */
%name(gluNewNurbsRenderer) PyGLUnurbs* _gluNewNurbsRenderer();
DOC(gluNewNurbsRenderer, "gluNewNurbsRenderer() -> GLUnurbs")
%name(gluDeleteNurbsRenderer) void __ignoreDeletionCall(PyObject *tess);
DOC(gluDeleteNurbsRenderer, "gluDeleteNurbsRenderer(nobj) -> None (null function, use del nobj instead)")
void gluBeginSurface(GLUnurbs *nobj);
DOC(gluBeginSurface, "gluBeginSurface(nobj) -> None")
void gluBeginCurve(GLUnurbs *nobj);
DOC(gluBeginCurve, "gluBeginCurve(nobj) -> None")
void gluEndCurve(GLUnurbs *nobj);
DOC(gluEndCurve, "gluEndCurve(nobj) -> None")
void gluEndSurface(GLUnurbs *nobj);
DOC(gluEndSurface, "gluEndSurface(nobj) -> None")
void gluBeginTrim(GLUnurbs *nobj);
DOC(gluBeginTrim, "gluBeginTrim(nobj) -> None")
void gluEndTrim(GLUnurbs *nobj);
DOC(gluEndTrim, "gluEndTrim(nobj) -> None")
%{
#define _gluPwlCurve(nobj, count, array, stride, type) \
gluPwlCurve(nobj, count, (GLfloat*)array, stride, type)
%}
%name(gluPwlCurve) void _gluPwlCurve(
GLUnurbs *nobj, GLint d_1_0,
const GLfloat *array,
GLint d_1_1, GLenum type
);
DOC(gluPwlCurve, "gluPwlCurve(nobj, array, type) -> None")
%{
#define _gluNurbsCurve(nobj, n_2, knot, d_5_0, d_5_1, ctlarray, type) \
gluNurbsCurve(nobj, n_2, (GLfloat*)knot, d_5_1, (GLfloat*)ctlarray, n_2 - d_5_0, type)
%}
%name(gluNurbsCurve) void _gluNurbsCurve(GLUnurbs *nobj, GLint n_2, const GLfloat *knot, GLint d_5_0, GLint d_5_1, const GLfloat *ctlarray, GLenum type);
DOC(gluNurbsCurve, "gluNurbsCurve(nobj, knot, ctlarray, type) -> None")
%{
#define _gluNurbsSurface(nobj, sknot_len, sknot, tknot_len, tknot, d_0, d_1, d_2, ctlarray, type)\
gluNurbsSurface(\
nobj, sknot_len, (GLfloat*)sknot, tknot_len, (GLfloat*)tknot, \
d_1*d_2, d_2, (GLfloat*)ctlarray, sknot_len-d_0, tknot_len-d_1, type \
)
%}
/* I (Mike) have _no_ idea why this requires d_6_* instead of d_4_* :( */
%name(gluNurbsSurface) void _gluNurbsSurface(GLUnurbs *nobj, GLint n_2, const GLfloat *sknot, GLint n_3, const GLfloat *tknot, GLint d_6_0, GLint d_6_1, GLint d_6_2,
const GLfloat *ctlarray, GLenum type);
DOC(gluNurbsSurface, "gluNurbsSurface(nobj, sknot, tknot, ctlarray, type) -> None")
void gluLoadSamplingMatrices(GLUnurbs *nobj, const GLfloat *modelMatrix, const GLfloat *projMatrix, const GLint *viewport);
DOC(gluLoadSamplingMatrices, "gluLoadSamplingMatrices(nobj, modelMatrix, projMatrix, viewport) -> None")
void gluNurbsProperty(GLUnurbs *nobj, GLenum property, GLfloat value);
DOC(gluNurbsProperty, "gluNurbsProperty(nobj, property, value) -> None")
void gluGetNurbsProperty(GLUnurbs *nobj, GLenum property, GLfloat value[1]);
DOC(gluGetNurbsProperty, "gluGetNurbsProperty(nobj, property) -> value")
/*void gluNurbsCallback(GLUnurbs *nobj, GLenum which, void (CALLBACK* pyfunc)() ); */
%name(gluNurbsCallback) PyObject* _gluNurbsCallback(PyGLUnurbs* self, GLenum which, PyObject* pyfunc);
DOC(gluNurbsCallback, "gluNurbsCallback(qobj, which, func)")
#if API_VERSION >= 259 /* GLU 1.3 */
%{
void _gluNurbsCallbackData(PyGLUnurbs *self, PyObject *data)
{
Py_DECREF(self->data);
Py_INCREF(self->data = data);
gluNurbsCallbackData(self->obj, (void*)data);
}
%}
%name(gluNurbsCallbackData) void _gluNurbsCallbackData(PyGLUnurbs *nobj, PyObject *data);
DOC(gluNurbsCallbackData, "gluNurbsCallbackData(nobj, data) -> None")
#endif
/* turn the exception handler on for GLU_EXT_nurbs_tessellator */
GL_EXCEPTION_HANDLER()
%{
#if !EXT_DEFINES_PROTO || !defined(GLU_EXT_nurbs_tessellator)
DECLARE_VOID_EXT(gluNurbsCallbackDataEXT, \
(GLUnurbs* theNurb, void* userData),\
(theNurb, userData))
#endif
#define __gluNurbsCallbackDataEXT(nobj, data) gluNurbsCallbackDataEXT(nobj, (void*)data)
%}
void __gluNurbsCallbackDataEXT(GLUnurbs *nobj, PyObject *data);
DOC(__gluNurbsCallbackDataEXT, "gluNurbsCallbackDataEXT(nobj, data) -> None")
%{
static char *proc_names[] =
{
#if !EXT_DEFINES_PROTO || !defined(GLU_EXT_nurbs_tessellator)
"gluNurbsCallbackDataEXT",
#endif
NULL
};
#define __gluInitNurbsTessellatorEXT() InitExtension("GLU_EXT_nurbs_tessellator", proc_names)
%}
int __gluInitNurbsTessellatorEXT();
DOC(__gluInitNurbsTessellatorEXT, "gluInitNurbsTessellatorEXT() -> bool")
/* revert to the normal exception handler */
GL_EXCEPTION_HANDLER()
/* Generic constants */
/* Version */
#if API_VERSION >= 257
#define GLU_VERSION_1_1 1
#endif
#if API_VERSION >= 258
#define GLU_VERSION_1_2 1
#endif
#if API_VERSION >= 259
#define GLU_VERSION_1_3 1
#endif
/* Errors: (return value 0 = no error) */
#define GLU_INVALID_ENUM 100900
#define GLU_INVALID_VALUE 100901
#define GLU_OUT_OF_MEMORY 100902
#define GLU_INCOMPATIBLE_GL_VERSION 100903
#if API_VERSION >= 257
/* StringName */
#define GLU_VERSION 100800
#define GLU_EXTENSIONS 100801
#endif
/* Boolean */
#define GLU_TRUE GL_TRUE
#define GLU_FALSE GL_FALSE
/* Quadric constants */
/* QuadricNormal */
#define GLU_SMOOTH 100000
#define GLU_FLAT 100001
#define GLU_NONE 100002
/* QuadricDrawStyle */
#define GLU_POINT 100010
#define GLU_LINE 100011
#define GLU_FILL 100012
#define GLU_SILHOUETTE 100013
/* QuadricOrientation */
#define GLU_OUTSIDE 100020
#define GLU_INSIDE 100021
/* Callback types: */
/* GLU_ERROR 100103 */
/* Tesselation constants */
#define GLU_TESS_MAX_COORD 1.0e150
/* TessProperty */
#define GLU_TESS_WINDING_RULE 100140
#define GLU_TESS_BOUNDARY_ONLY 100141
#define GLU_TESS_TOLERANCE 100142
/* TessWinding */
#define GLU_TESS_WINDING_ODD 100130
#define GLU_TESS_WINDING_NONZERO 100131
#define GLU_TESS_WINDING_POSITIVE 100132
#define GLU_TESS_WINDING_NEGATIVE 100133
#define GLU_TESS_WINDING_ABS_GEQ_TWO 100134
/* TessCallback */
#define GLU_TESS_BEGIN 100100
#define GLU_TESS_VERTEX 100101
#define GLU_TESS_END 100102
#define GLU_TESS_ERROR 100103
#define GLU_TESS_EDGE_FLAG 100104
#define GLU_TESS_COMBINE 100105
#define GLU_TESS_BEGIN_DATA 100106
#define GLU_TESS_VERTEX_DATA 100107
#define GLU_TESS_END_DATA 100108
#define GLU_TESS_ERROR_DATA 100109
#define GLU_TESS_EDGE_FLAG_DATA 100110
#define GLU_TESS_COMBINE_DATA 100111
/* TessError */
#define GLU_TESS_ERROR1 100151
#define GLU_TESS_ERROR2 100152
#define GLU_TESS_ERROR3 100153
#define GLU_TESS_ERROR4 100154
#define GLU_TESS_ERROR5 100155
#define GLU_TESS_ERROR6 100156
#define GLU_TESS_ERROR7 100157
#define GLU_TESS_ERROR8 100158
#define GLU_TESS_MISSING_BEGIN_POLYGON GLU_TESS_ERROR1
#define GLU_TESS_MISSING_BEGIN_CONTOUR GLU_TESS_ERROR2
#define GLU_TESS_MISSING_END_POLYGON GLU_TESS_ERROR3
#define GLU_TESS_MISSING_END_CONTOUR GLU_TESS_ERROR4
#define GLU_TESS_COORD_TOO_LARGE GLU_TESS_ERROR5
#define GLU_TESS_NEED_COMBINE_CALLBACK GLU_TESS_ERROR6
/* NURBS constants */
/* NurbsProperty */
#define GLU_AUTO_LOAD_MATRIX 100200
#define GLU_CULLING 100201
#define GLU_SAMPLING_TOLERANCE 100203
#define GLU_DISPLAY_MODE 100204
#if API_VERSION > 257
#define GLU_PARAMETRIC_TOLERANCE 100202
#define GLU_SAMPLING_METHOD 100205
#define GLU_U_STEP 100206
#define GLU_V_STEP 100207
#endif
/* NurbsSampling */
#define GLU_PATH_LENGTH 100215
#define GLU_PARAMETRIC_ERROR 100216
#define GLU_DOMAIN_DISTANCE 100217
/* NurbsTrim */
#define GLU_MAP1_TRIM_2 100210
#define GLU_MAP1_TRIM_3 100211
/* NurbsDisplay */
#define GLU_OUTLINE_POLYGON 100240
#define GLU_OUTLINE_PATCH 100241
/* NurbsErrors */
#define GLU_NURBS_ERROR1 100251
#define GLU_NURBS_ERROR2 100252
#define GLU_NURBS_ERROR3 100253
#define GLU_NURBS_ERROR4 100254
#define GLU_NURBS_ERROR5 100255
#define GLU_NURBS_ERROR6 100256
#define GLU_NURBS_ERROR7 100257
#define GLU_NURBS_ERROR8 100258
#define GLU_NURBS_ERROR9 100259
#define GLU_NURBS_ERROR10 100260
#define GLU_NURBS_ERROR11 100261
#define GLU_NURBS_ERROR12 100262
#define GLU_NURBS_ERROR13 100263
#define GLU_NURBS_ERROR14 100264
#define GLU_NURBS_ERROR15 100265
#define GLU_NURBS_ERROR16 100266
#define GLU_NURBS_ERROR17 100267
#define GLU_NURBS_ERROR18 100268
#define GLU_NURBS_ERROR19 100269
#define GLU_NURBS_ERROR20 100270
#define GLU_NURBS_ERROR21 100271
#define GLU_NURBS_ERROR22 100272
#define GLU_NURBS_ERROR23 100273
#define GLU_NURBS_ERROR24 100274
#define GLU_NURBS_ERROR25 100275
#define GLU_NURBS_ERROR26 100276
#define GLU_NURBS_ERROR27 100277
#define GLU_NURBS_ERROR28 100278
#define GLU_NURBS_ERROR29 100279
#define GLU_NURBS_ERROR30 100280
#define GLU_NURBS_ERROR31 100281
#define GLU_NURBS_ERROR32 100282
#define GLU_NURBS_ERROR33 100283
#define GLU_NURBS_ERROR34 100284
#define GLU_NURBS_ERROR35 100285
#define GLU_NURBS_ERROR36 100286
#define GLU_NURBS_ERROR37 100287
/* Contours types -- obsolete! */
#define GLU_CW 100120
#define GLU_CCW 100121
#define GLU_INTERIOR 100122
#define GLU_EXTERIOR 100123
#define GLU_UNKNOWN 100124
/* Names without "TESS_" prefix */
#define GLU_BEGIN GLU_TESS_BEGIN
#define GLU_VERTEX GLU_TESS_VERTEX
#define GLU_END GLU_TESS_END
#define GLU_ERROR GLU_TESS_ERROR
#define GLU_EDGE_FLAG GLU_TESS_EDGE_FLAG
#if API_VERSION >= 259
/* Nurbs tesselator */
#define GLU_NURBS_MODE 100160
#define GLU_NURBS_TESSELLATOR 100161
#define GLU_NURBS_RENDERER 100162
#define GLU_NURBS_BEGIN 100164
#define GLU_NURBS_VERTEX 100165
#define GLU_NURBS_NORMAL 100166
#define GLU_NURBS_COLOR 100167
#define GLU_NURBS_TEXTURE_COORD 100168
#define GLU_NURBS_END 100169
#define GLU_NURBS_BEGIN_DATA 100170
#define GLU_NURBS_VERTEX_DATA 100171
#define GLU_NURBS_NORMAL_DATA 100172
#define GLU_NURBS_COLOR_DATA 100173
#define GLU_NURBS_TEXTURE_COORD_DATA 100174
#define GLU_NURBS_END_DATA 100175
/* Object space tess */
#define GLU_OBJECT_PARAMETRIC_ERROR 100208
#define GLU_OBJECT_PATH_LENGTH 100209
#endif
/*
FIXME: why do we need import string here?
*/
%shadow %{
def __info():
import string
return [('GLU_VERSION', GLU_VERSION, 'su'),
('GLU_EXTENSIONS', GLU_EXTENSIONS, 'eu')]
%}
%shadow %{
GLUerror = GLU__init___.GLUerror
__api_version__ = GLU__init___.__api_version__
__author__ = GLU__init___.__author__
__date__ = GLU__init___.__date__
__doc__ = GLU__init___.__doc__
__version__ = GLU__init___.__version__
%}
|