| 1594 | | __GetProcAddress = |
|---|
| 1595 | | (void (*(*)(const GLubyte*))()) dlsym(libHandle, |
|---|
| 1596 | | "glXGetProcAddressARB"); |
|---|
| 1597 | | |
|---|
| 1598 | | if(__GetProcAddress == NULL) |
|---|
| 1599 | | { |
|---|
| 1600 | | __GetProcAddress = |
|---|
| 1601 | | (void (*(*)(const GLubyte*))()) dlsym(libHandle, |
|---|
| 1602 | | "glXGetProcAddress"); |
|---|
| 1603 | | |
|---|
| 1604 | | if(__GetProcAddress == NULL) |
|---|
| 1605 | | { |
|---|
| 1606 | | // Couldn't find it linked to the executable. Try to open |
|---|
| 1607 | | // libGL.so directly. |
|---|
| 1608 | | |
|---|
| 1609 | | dlclose(libHandle); |
|---|
| 1610 | | |
|---|
| 1611 | | libHandle = dlopen("libGL.so", RTLD_NOW | RTLD_GLOBAL); |
|---|
| 1612 | | |
|---|
| 1613 | | if(!libHandle) |
|---|
| 1614 | | { |
|---|
| 1615 | | FWARNING(("Error in dlopen: %s\n",dlerror())); |
|---|
| 1616 | | abort(); |
|---|
| 1617 | | } |
|---|
| 1618 | | else |
|---|
| 1619 | | { |
|---|
| 1620 | | FDEBUG(("Opened libGL.so for GL extension handling.\n")); |
|---|
| 1621 | | } |
|---|
| 1622 | | |
|---|
| 1623 | | __GetProcAddress = |
|---|
| 1624 | | (void (*(*)(const GLubyte*))()) dlsym( |
|---|
| 1625 | | libHandle, "glXGetProcAddressARB"); |
|---|
| 1626 | | |
|---|
| 1627 | | if(__GetProcAddress == NULL) |
|---|
| 1628 | | { |
|---|
| 1629 | | __GetProcAddress = |
|---|
| 1630 | | (void (*(*)(const GLubyte*))())dlsym( |
|---|
| 1631 | | libHandle, "glXGetProcAddress"); |
|---|
| 1632 | | } |
|---|
| 1633 | | |
|---|
| 1634 | | |
|---|
| 1635 | | if(__GetProcAddress == NULL) |
|---|
| 1636 | | { |
|---|
| 1637 | | FWARNING(("Neither glXGetProcAddress nor " |
|---|
| 1638 | | "glXGetProcAddressARB found! Disabling all " |
|---|
| 1639 | | " extensions for Window %p!\n")); |
|---|
| 1640 | | |
|---|
| 1641 | | _availExtensions.clear(); |
|---|
| 1642 | | _availExtensions.resize(_registeredExtensions.size(), |
|---|
| 1643 | | false); |
|---|
| 1644 | | } |
|---|
| 1645 | | } |
|---|
| 1646 | | else |
|---|
| 1647 | | { |
|---|
| 1648 | | FDEBUG(("Using glXGetProcAddress for GL " |
|---|
| 1649 | | "extension handling.\n")); |
|---|
| 1650 | | } |
|---|
| 1651 | | } |
|---|
| 1652 | | else |
|---|
| 1653 | | { |
|---|
| 1654 | | FDEBUG(("Using glXGetProcAddressARB for GL " |
|---|
| 1655 | | "extension handling.\n")); |
|---|
| | 1604 | FINFO(("Finding glxGetProcAddress method: ")); |
|---|
| | 1605 | |
|---|
| | 1606 | #ifdef TRY_USING_GLXGETPROC_DIRECTLY |
|---|
| | 1607 | |
|---|
| | 1608 | // Try pulling in ARB function directly |
|---|
| | 1609 | /* |
|---|
| | 1610 | #ifdef GLX_ARB_get_proc_address |
|---|
| | 1611 | if(__GetProcAddress == NULL) |
|---|
| | 1612 | { |
|---|
| | 1613 | __GetProcAddress = glXGetProcAddressARB; |
|---|
| | 1614 | FINFO((" Using glxGetProcAddressARB directly.\n")); |
|---|
| | 1615 | } |
|---|
| | 1616 | #endif |
|---|
| | 1617 | */ |
|---|
| | 1618 | // If GLX version is 1.4 or greater then the method should exist |
|---|
| | 1619 | #ifdef GLX_VERSION_1_4 |
|---|
| | 1620 | if(__GetProcAddress == NULL) |
|---|
| | 1621 | { |
|---|
| | 1622 | __GetProcAddress = glXGetProcAddress; |
|---|
| | 1623 | FINFO((" Using glxGetProcAddress directly.\n")); |
|---|
| | 1624 | } |
|---|
| | 1625 | #endif |
|---|
| | 1626 | #endif |
|---|
| | 1627 | if(__GetProcAddress == NULL) |
|---|
| | 1628 | { |
|---|
| | 1629 | __GetProcAddress = |
|---|
| | 1630 | (void (*(*)(const GLubyte*))()) dlsym(libHandle, |
|---|
| | 1631 | "glXGetProcAddressARB"); |
|---|
| | 1632 | |
|---|
| | 1633 | if(__GetProcAddress == NULL) |
|---|
| | 1634 | { |
|---|
| | 1635 | __GetProcAddress = |
|---|
| | 1636 | (void (*(*)(const GLubyte*))()) dlsym(libHandle, |
|---|
| | 1637 | "glXGetProcAddress"); |
|---|
| | 1638 | |
|---|
| | 1639 | if(__GetProcAddress == NULL) |
|---|
| | 1640 | { |
|---|
| | 1641 | // Couldn't find it linked to the executable. Try to open |
|---|
| | 1642 | // libGL.so directly. |
|---|
| | 1643 | |
|---|
| | 1644 | dlclose(libHandle); |
|---|
| | 1645 | |
|---|
| | 1646 | libHandle = dlopen("libGL.so", RTLD_NOW | RTLD_GLOBAL); |
|---|
| | 1647 | |
|---|
| | 1648 | if(!libHandle) |
|---|
| | 1649 | { |
|---|
| | 1650 | FWARNING(("Error in dlopen: %s\n",dlerror())); |
|---|
| | 1651 | abort(); |
|---|
| | 1652 | } |
|---|
| | 1653 | else |
|---|
| | 1654 | { |
|---|
| | 1655 | FINFO((" Using libGL.so directly.\n")); |
|---|
| | 1656 | } |
|---|
| | 1657 | |
|---|
| | 1658 | __GetProcAddress = |
|---|
| | 1659 | (void (*(*)(const GLubyte*))()) dlsym( |
|---|
| | 1660 | libHandle, "glXGetProcAddressARB"); |
|---|
| | 1661 | |
|---|
| | 1662 | if(__GetProcAddress == NULL) |
|---|
| | 1663 | { |
|---|
| | 1664 | __GetProcAddress = |
|---|
| | 1665 | (void (*(*)(const GLubyte*))())dlsym( |
|---|
| | 1666 | libHandle, "glXGetProcAddress"); |
|---|
| | 1667 | } |
|---|
| | 1668 | |
|---|
| | 1669 | |
|---|
| | 1670 | if(__GetProcAddress == NULL) |
|---|
| | 1671 | { |
|---|
| | 1672 | FWARNING(("Neither glXGetProcAddress nor " |
|---|
| | 1673 | "glXGetProcAddressARB found! Disabling all " |
|---|
| | 1674 | " extensions for Window %p!\n")); |
|---|
| | 1675 | |
|---|
| | 1676 | _availExtensions.clear(); |
|---|
| | 1677 | _availExtensions.resize(_registeredExtensions.size(), |
|---|
| | 1678 | false); |
|---|
| | 1679 | } |
|---|
| | 1680 | } |
|---|
| | 1681 | else |
|---|
| | 1682 | { |
|---|
| | 1683 | FINFO((" Using glXGetProcAddress (from %s).\n", libHandleName.c_str())); |
|---|
| | 1684 | } |
|---|
| | 1685 | } |
|---|
| | 1686 | else |
|---|
| | 1687 | { |
|---|
| | 1688 | FINFO(("Using glXGetProcAddressARB (from %s).\n", libHandleName.c_str())); |
|---|
| | 1689 | } |
|---|