gl_extensions.cpp.m4 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #include "idlib/precompiled.h"
  2. #pragma hdrstop
  3. dnl =====================================================
  4. dnl utils
  5. dnl =====================================================
  6. define(`forloop',
  7. `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')')
  8. define(`_forloop',
  9. `$4`'ifelse($1, `$3', ,
  10. `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')')
  11. dnl =====================================================
  12. dnl GL extensions
  13. dnl =====================================================
  14. typedef struct {
  15. const char *ext_name;
  16. } glExtName_t;
  17. glExtName_t glExtNames[] = {
  18. NULL
  19. };
  20. static void StubFunction( void ) { }
  21. GLExtension_t GLimp_ExtensionPointer( const char *name ) {
  22. if ( strstr( name, "wgl" ) == name ) {
  23. common->DPrintf( "WARNING: GLimp_ExtensionPointer for '%s'\n", name );
  24. }
  25. #ifdef ID_DEDICATED
  26. common->Printf("GLimp_ExtensionPointer %s\n", name);
  27. return StubFunction;
  28. #else
  29. #if 0
  30. glExtName_t *n;
  31. for ( n = glExtNames ; n->ext_name ; n++ ) {
  32. if ( !strcmp( name, n->ext_name ) ) {
  33. common->DPrintf("matched GL extension: %s\n", name );
  34. break;
  35. }
  36. }
  37. if ( ! n->ext_name ) {
  38. common->DPrintf("unmatched GL extension name: %s\n", name );
  39. }
  40. #endif
  41. GLExtension_t ret;
  42. #if defined(__linux__)
  43. // for some reason glXGetProcAddressARB doesn't work on RH9?
  44. ret = qglXGetProcAddressARB((const GLubyte *) name);
  45. if ( !ret ) {
  46. common->Printf("glXGetProcAddressARB failed: \"%s\"\n", name);
  47. return StubFunction;
  48. }
  49. #else
  50. #error Need OS define
  51. #endif
  52. return ret;
  53. #endif
  54. }