Subversion Repositories Games.Descent

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * This file is part of the DXX-Rebirth project <https://www.dxx-rebirth.com/>.
  3.  * It is copyright by its individual contributors, as recorded in the
  4.  * project's Git history.  See COPYING.txt at the top level for license
  5.  * terms and a link to the Git history.
  6.  */
  7. /*
  8.  *
  9.  * dynamic opengl loading - courtesy of Jeff Slutter
  10.  *
  11.  *
  12.  */
  13.  
  14. #ifndef __LOADGL_H__
  15. #define __LOADGL_H__
  16.  
  17. #ifdef _WIN32
  18. #include <windows.h>
  19. #define OGLFUNCCALL     __stdcall
  20. #else
  21. #define OGLFUNCCALL
  22. #endif
  23.  
  24. #include <GL/gl.h>
  25. #include "pstypes.h"
  26.  
  27. //gl extensions.
  28. #ifndef GL_ARB_multitexture
  29. #define GL_ARB_multitexture 1
  30. #define GL_TEXTURE0_ARB 0x84C0
  31. #define GL_TEXTURE1_ARB 0x84C1
  32. #define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
  33. #endif
  34.  
  35. #ifndef GL_SGIS_multitexture
  36. #define GL_SGIS_multitexture 1
  37. #define GL_TEXTURE0_SGIS 0x835F
  38. #define GL_TEXTURE1_SGIS 0x8360
  39. #define GL_MAX_TEXTURES_SGIS 0x835D
  40. #endif
  41.  
  42. #ifndef GL_EXT_paletted_texture
  43. #define GL_EXT_paletted_texture 1
  44. #define GL_COLOR_INDEX8_EXT 0x80E5
  45. #define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED
  46. #endif
  47.  
  48. #ifndef GL_TEXTURE_INDEX_SIZE_EXT
  49. #define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED
  50. #endif
  51.  
  52. #ifndef GL_SCISSOR_TEST
  53. #define GL_SCISSOR_TEST 0x0C11
  54. #endif
  55.  
  56. #ifndef GL_CLAMP_TO_EDGE
  57. #define GL_CLAMP_TO_EDGE 0x812F
  58. #endif
  59.  
  60. #ifndef GL_NV_register_combiners
  61. #define GL_NV_register_combiners 1
  62. #define GL_REGISTER_COMBINERS_NV          0x8522
  63. #define GL_VARIABLE_A_NV                  0x8523
  64. #define GL_VARIABLE_B_NV                  0x8524
  65. #define GL_VARIABLE_C_NV                  0x8525
  66. #define GL_VARIABLE_D_NV                  0x8526
  67. #define GL_VARIABLE_E_NV                  0x8527
  68. #define GL_VARIABLE_F_NV                  0x8528
  69. #define GL_VARIABLE_G_NV                  0x8529
  70. #define GL_CONSTANT_COLOR0_NV             0x852A
  71. #define GL_CONSTANT_COLOR1_NV             0x852B
  72. #define GL_PRIMARY_COLOR_NV               0x852C
  73. #define GL_SECONDARY_COLOR_NV             0x852D
  74. #define GL_SPARE0_NV                      0x852E
  75. #define GL_SPARE1_NV                      0x852F
  76. #define GL_DISCARD_NV                     0x8530
  77. #define GL_E_TIMES_F_NV                   0x8531
  78. #define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532
  79. #define GL_UNSIGNED_IDENTITY_NV           0x8536
  80. #define GL_UNSIGNED_INVERT_NV             0x8537
  81. #define GL_EXPAND_NORMAL_NV               0x8538
  82. #define GL_EXPAND_NEGATE_NV               0x8539
  83. #define GL_HALF_BIAS_NORMAL_NV            0x853A
  84. #define GL_HALF_BIAS_NEGATE_NV            0x853B
  85. #define GL_SIGNED_IDENTITY_NV             0x853C
  86. #define GL_SIGNED_NEGATE_NV               0x853D
  87. #define GL_SCALE_BY_TWO_NV                0x853E
  88. #define GL_SCALE_BY_FOUR_NV               0x853F
  89. #define GL_SCALE_BY_ONE_HALF_NV           0x8540
  90. #define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV   0x8541
  91. #define GL_COMBINER_INPUT_NV              0x8542
  92. #define GL_COMBINER_MAPPING_NV            0x8543
  93. #define GL_COMBINER_COMPONENT_USAGE_NV    0x8544
  94. #define GL_COMBINER_AB_DOT_PRODUCT_NV     0x8545
  95. #define GL_COMBINER_CD_DOT_PRODUCT_NV     0x8546
  96. #define GL_COMBINER_MUX_SUM_NV            0x8547
  97. #define GL_COMBINER_SCALE_NV              0x8548
  98. #define GL_COMBINER_BIAS_NV               0x8549
  99. #define GL_COMBINER_AB_OUTPUT_NV          0x854A
  100. #define GL_COMBINER_CD_OUTPUT_NV          0x854B
  101. #define GL_COMBINER_SUM_OUTPUT_NV         0x854C
  102. #define GL_MAX_GENERAL_COMBINERS_NV       0x854D
  103. #define GL_NUM_GENERAL_COMBINERS_NV       0x854E
  104. #define GL_COLOR_SUM_CLAMP_NV             0x854F
  105. #define GL_COMBINER0_NV                   0x8550
  106. #define GL_COMBINER1_NV                   0x8551
  107. #define GL_COMBINER2_NV                   0x8552
  108. #define GL_COMBINER3_NV                   0x8553
  109. #define GL_COMBINER4_NV                   0x8554
  110. #define GL_COMBINER5_NV                   0x8555
  111. #define GL_COMBINER6_NV                   0x8556
  112. #define GL_COMBINER7_NV                   0x8557
  113. #endif
  114.  
  115. #define GL_SCISSOR_TEST 0x0C11
  116.  
  117. #ifdef __cplusplus
  118. #define OEXTERN extern "C"
  119. #else
  120. #define OEXTERN extern
  121. #define true 1
  122. #define false 0
  123. #endif
  124.  
  125. #ifdef DECLARE_VARS
  126. #define DEFVAR
  127. #else
  128. #define DEFVAR  OEXTERN
  129. #endif
  130.  
  131. #define glAlphaFunc dglAlphaFunc
  132. #define glBindTexture dglBindTexture
  133. #define glBlendFunc dglBlendFunc
  134. #define glClear dglClear
  135. #define glClearColor dglClearColor
  136. #define glColor4f dglColor4f
  137. #define glColorPointer dglColorPointer
  138. #define glCullFace dglCullFace
  139. #define glDeleteTextures dglDeleteTextures
  140. #define glDepthFunc dglDepthFunc
  141. #define glDepthMask dglDepthMask
  142. #define glDisable dglDisable
  143. #define glDisableClientState dglDisableClientState
  144. #define glDrawArrays dglDrawArrays
  145. #define glEnable dglEnable
  146. #define glEnableClientState dglEnableClientState
  147. #define glEnd dglEnd
  148. #define glFinish dglFinish
  149. #define glGenTextures dglGenTextures
  150. #define glGetFloatv dglGetFloatv
  151. #define glGetIntegerv dglGetIntegerv
  152. #define glGetString dglGetString
  153. #define glGetTexLevelParameteriv dglGetTexLevelParameteriv
  154. #define glHint dglHint
  155. #define glLineWidth dglLineWidth
  156. #define glLoadIdentity dglLoadIdentity
  157. #define glMatrixMode dglMatrixMode
  158. #define glOrtho dglOrtho
  159. #define glPointSize dglPointSize
  160. #define glPopMatrix dglPopMatrix
  161. #define glPrioritizeTextures dglPrioritizeTextures
  162. #define glPushMatrix dglPushMatrix
  163. #define glReadBuffer dglReadBuffer
  164. #define glReadPixels dglReadPixels
  165. #define glScalef dglScalef
  166. #define glShadeModel dglShadeModel
  167. #define glTexCoordPointer dglTexCoordPointer
  168. #define glTexEnvi dglTexEnvi
  169. #define glTexImage2D dglTexImage2D
  170. #define glTexParameterf dglTexParameterf
  171. #define glTexParameteri dglTexParameteri
  172. #define glTranslatef dglTranslatef
  173. #define glVertexPointer dglVertexPointer
  174. #define glViewport dglViewport
  175.  
  176. typedef void (OGLFUNCCALL *glAlphaFunc_fp)(GLenum func, GLclampf ref);
  177. typedef void (OGLFUNCCALL *glBindTexture_fp)(GLenum target, GLuint texture);
  178. typedef void (OGLFUNCCALL *glBlendFunc_fp)(GLenum sfactor, GLenum dfactor);
  179. typedef void (OGLFUNCCALL *glClear_fp)(GLbitfield mask);
  180. typedef void (OGLFUNCCALL *glClearColor_fp)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
  181. typedef void (OGLFUNCCALL *glColor4f_fp)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
  182. typedef void (OGLFUNCCALL *glColorPointer_fp)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
  183. typedef void (OGLFUNCCALL *glCullFace_fp)(GLenum mode);
  184. typedef void (OGLFUNCCALL *glDeleteTextures_fp)(GLsizei n, const GLuint *textures);
  185. typedef void (OGLFUNCCALL *glDepthFunc_fp)(GLenum func);
  186. typedef void (OGLFUNCCALL *glDepthMask_fp)(GLboolean flag);
  187. typedef void (OGLFUNCCALL *glDisable_fp)(GLenum cap);
  188. typedef void (OGLFUNCCALL *glDisableClientState_fp)(GLenum array);
  189. typedef void (OGLFUNCCALL *glDrawArrays_fp)(GLenum mode, GLint first, GLsizei count);
  190. typedef void (OGLFUNCCALL *glEnable_fp)(GLenum cap);
  191. typedef void (OGLFUNCCALL *glEnableClientState_fp)(GLenum array);
  192. typedef void (OGLFUNCCALL *glEnd_fp)(void);
  193. typedef void (OGLFUNCCALL *glFinish_fp)(void);
  194. typedef void (OGLFUNCCALL *glGenTextures_fp)(GLsizei n, GLuint *textures);
  195. typedef void (OGLFUNCCALL *glGetFloatv_fp)(GLenum pname, GLfloat *params);
  196. typedef void (OGLFUNCCALL *glGetIntegerv_fp)(GLenum pname, GLint *params);
  197. typedef const GLubyte *(OGLFUNCCALL *glGetString_fp)(GLenum name);
  198. typedef void (OGLFUNCCALL *glGetTexLevelParameteriv_fp)(GLenum target, GLint level, GLenum pname, GLint *params);
  199. typedef void (OGLFUNCCALL *glHint_fp)(GLenum target, GLenum mode);
  200. typedef void (OGLFUNCCALL *glLineWidth_fp)(GLfloat width);
  201. typedef void (OGLFUNCCALL *glLoadIdentity_fp)(void);
  202. typedef void (OGLFUNCCALL *glMatrixMode_fp)(GLenum mode);
  203. typedef void (OGLFUNCCALL *glOrtho_fp)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
  204. typedef void (OGLFUNCCALL *glPointSize_fp)(GLfloat size);
  205. typedef void (OGLFUNCCALL *glPopMatrix_fp)(void);
  206. typedef void (OGLFUNCCALL *glPrioritizeTextures_fp)(GLsizei n, const GLuint *textures, const GLclampf *priorities);
  207. typedef void (OGLFUNCCALL *glPushMatrix_fp)(void);
  208. typedef void (OGLFUNCCALL *glReadBuffer_fp)(GLenum mode);
  209. typedef void (OGLFUNCCALL *glReadPixels_fp)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
  210. typedef void (OGLFUNCCALL *glScalef_fp)(GLfloat x, GLfloat y, GLfloat z);
  211. typedef void (OGLFUNCCALL *glShadeModel_fp)(GLenum mode);
  212. typedef void (OGLFUNCCALL *glTexCoordPointer_fp)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
  213. typedef void (OGLFUNCCALL *glTexEnvi_fp)(GLenum target, GLenum pname, GLint param);
  214. typedef void (OGLFUNCCALL *glTexImage2D_fp)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
  215. typedef void (OGLFUNCCALL *glTexParameterf_fp)(GLenum target, GLenum pname, GLfloat param);
  216. typedef void (OGLFUNCCALL *glTexParameteri_fp)(GLenum target, GLenum pname, GLint param);
  217. typedef void (OGLFUNCCALL *glTranslatef_fp)(GLfloat x, GLfloat y, GLfloat z);
  218. typedef void (OGLFUNCCALL *glVertexPointer_fp)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
  219. typedef void (OGLFUNCCALL *glViewport_fp)(GLint x, GLint y, GLsizei width, GLsizei height);
  220.  
  221. typedef void (OGLFUNCCALL *glMultiTexCoord2fARB_fp)(GLenum target, GLfloat s, GLfloat t);
  222. typedef void (OGLFUNCCALL *glActiveTextureARB_fp)(GLenum target);
  223. typedef void (OGLFUNCCALL *glMultiTexCoord2fSGIS_fp)(GLenum target, GLfloat s, GLfloat t);
  224. typedef void (OGLFUNCCALL *glSelectTextureSGIS_fp)(GLenum target);
  225.  
  226. #ifdef _WIN32
  227. typedef PROC  (OGLFUNCCALL *wglGetProcAddress_fp)(LPCSTR);
  228. #endif
  229.  
  230. DEFVAR glAlphaFunc_fp dglAlphaFunc;
  231. DEFVAR glBindTexture_fp dglBindTexture;
  232. DEFVAR glBlendFunc_fp dglBlendFunc;
  233. DEFVAR glClear_fp dglClear;
  234. DEFVAR glClearColor_fp dglClearColor;
  235. DEFVAR glColor4f_fp dglColor4f;
  236. DEFVAR glColorPointer_fp dglColorPointer;
  237. DEFVAR glCullFace_fp dglCullFace;
  238. DEFVAR glDeleteTextures_fp dglDeleteTextures;
  239. DEFVAR glDepthFunc_fp dglDepthFunc;
  240. DEFVAR glDepthMask_fp dglDepthMask;
  241. DEFVAR glDisable_fp dglDisable;
  242. DEFVAR glDisableClientState_fp dglDisableClientState;
  243. DEFVAR glDrawArrays_fp dglDrawArrays;
  244. DEFVAR glEnable_fp dglEnable;
  245. DEFVAR glEnableClientState_fp dglEnableClientState;
  246. DEFVAR glEnd_fp dglEnd;
  247. DEFVAR glFinish_fp dglFinish;
  248. DEFVAR glGenTextures_fp dglGenTextures;
  249. DEFVAR glGetFloatv_fp dglGetFloatv;
  250. DEFVAR glGetIntegerv_fp dglGetIntegerv;
  251. DEFVAR glGetString_fp dglGetString;
  252. DEFVAR glGetTexLevelParameteriv_fp dglGetTexLevelParameteriv;
  253. DEFVAR glHint_fp dglHint;
  254. DEFVAR glLineWidth_fp dglLineWidth;
  255. DEFVAR glLoadIdentity_fp dglLoadIdentity;
  256. DEFVAR glMatrixMode_fp dglMatrixMode;
  257. DEFVAR glOrtho_fp dglOrtho;
  258. DEFVAR glPointSize_fp dglPointSize;
  259. DEFVAR glPopMatrix_fp dglPopMatrix;
  260. DEFVAR glPrioritizeTextures_fp dglPrioritizeTextures;
  261. DEFVAR glPushMatrix_fp dglPushMatrix;
  262. DEFVAR glReadBuffer_fp dglReadBuffer;
  263. DEFVAR glReadPixels_fp dglReadPixels;
  264. DEFVAR glScalef_fp dglScalef;
  265. DEFVAR glShadeModel_fp dglShadeModel;
  266. DEFVAR glTexCoordPointer_fp dglTexCoordPointer;
  267. DEFVAR glTexEnvi_fp dglTexEnvi;
  268. DEFVAR glTexImage2D_fp dglTexImage2D;
  269. DEFVAR glTexParameterf_fp dglTexParameterf;
  270. DEFVAR glTexParameteri_fp dglTexParameteri;
  271. DEFVAR glTranslatef_fp dglTranslatef;
  272. DEFVAR glVertexPointer_fp dglVertexPointer;
  273. DEFVAR glViewport_fp dglViewport;
  274.  
  275. #ifdef DECLARE_VARS
  276.  
  277. // Dynamic module load functions
  278. #ifdef _WIN32
  279. static inline void *dll_LoadModule(const char *name)
  280. {
  281.         HINSTANCE handle;
  282.         handle = LoadLibrary(name);
  283.         return reinterpret_cast<void *>(handle);
  284. }
  285. static inline void dll_UnloadModule(void *hdl)
  286. {
  287.         if (hdl)
  288.         {
  289.                 FreeLibrary(reinterpret_cast<HINSTANCE>(hdl));
  290.         }
  291. }
  292. static void *dll_GetSymbol(void *dllhandle,const char *symname)
  293. {
  294.         if(!dllhandle)
  295.                 return NULL;
  296.         return reinterpret_cast<void *>(GetProcAddress(reinterpret_cast<HINSTANCE>(dllhandle), symname));
  297. }
  298. #endif
  299. #ifdef __unix__
  300. #include <dlfcn.h>
  301. static inline void *dll_LoadModule(const char *name)
  302. {
  303.         return (void *)dlopen(name,RTLD_NOW|RTLD_GLOBAL);
  304. }
  305. static inline void dll_UnloadModule(void *hdl)
  306. {
  307.         if(hdl)
  308.         {
  309.                 dlclose(hdl);
  310.         }
  311. }
  312. static void *dll_GetSymbol(void *dllhandle,const char *symname)
  313. {
  314.         if(!dllhandle)
  315.                 return NULL;
  316.         return dlsym(dllhandle,symname);
  317. }
  318. #endif
  319. #ifdef macintosh
  320. #include <SDL.h>
  321. static inline void *dll_LoadModule(const char *name)
  322. {
  323.         return SDL_GL_LoadLibrary(name) ? NULL : (void *) -1;   // return pointer is not dereferenced
  324. }
  325. static inline void dll_UnloadModule(void *hdl)
  326. {
  327.         hdl = hdl;      // SDL_GL_UnloadLibrary not exported by SDL
  328. }
  329. static void *dll_GetSymbol(void *dllhandle,const char *symname)
  330. {
  331.         if(!dllhandle)
  332.                 return NULL;
  333.         return SDL_GL_GetProcAddress(symname);
  334. }
  335. #endif
  336.  
  337. #endif //DECLARE_VARS
  338.  
  339. // pass true to load the library
  340. // pass false to unload it
  341. bool OpenGL_LoadLibrary(bool load, const char *OglLibPath);//load=true removed because not c++
  342. #ifdef DECLARE_VARS
  343. static void OpenGL_SetFuncsToNull(void);
  344.  
  345. void *OpenGLModuleHandle=NULL;
  346. bool OpenGL_LoadLibrary(bool load, const char *OglLibPath)
  347. {
  348.         if(load && OpenGLModuleHandle)
  349.                 return true;
  350.  
  351.         OpenGL_SetFuncsToNull();
  352.  
  353.         if(!load)
  354.         {
  355.                 if(OpenGLModuleHandle)
  356.                 {
  357.                         dll_UnloadModule(OpenGLModuleHandle);
  358.                         OpenGLModuleHandle = NULL;
  359.                 }
  360.                 return true;
  361.         }else
  362.         {
  363.                 OpenGLModuleHandle = dll_LoadModule(OglLibPath);
  364.                 if(!OpenGLModuleHandle)
  365.                         return false;
  366.  
  367.                 dglAlphaFunc = reinterpret_cast<glAlphaFunc_fp>(dll_GetSymbol(OpenGLModuleHandle,"glAlphaFunc"));
  368.                 dglBindTexture = reinterpret_cast<glBindTexture_fp>(dll_GetSymbol(OpenGLModuleHandle,"glBindTexture"));
  369.                 dglBlendFunc = reinterpret_cast<glBlendFunc_fp>(dll_GetSymbol(OpenGLModuleHandle,"glBlendFunc"));
  370.                 dglClear = reinterpret_cast<glClear_fp>(dll_GetSymbol(OpenGLModuleHandle,"glClear"));
  371.                 dglClearColor = reinterpret_cast<glClearColor_fp>(dll_GetSymbol(OpenGLModuleHandle,"glClearColor"));
  372.                 dglColor4f = reinterpret_cast<glColor4f_fp>(dll_GetSymbol(OpenGLModuleHandle,"glColor4f"));
  373.                 dglColorPointer = reinterpret_cast<glColorPointer_fp>(dll_GetSymbol(OpenGLModuleHandle,"glColorPointer"));
  374.                 dglCullFace = reinterpret_cast<glCullFace_fp>(dll_GetSymbol(OpenGLModuleHandle,"glCullFace"));
  375.                 dglDeleteTextures = reinterpret_cast<glDeleteTextures_fp>(dll_GetSymbol(OpenGLModuleHandle,"glDeleteTextures"));
  376.                 dglDepthFunc = reinterpret_cast<glDepthFunc_fp>(dll_GetSymbol(OpenGLModuleHandle,"glDepthFunc"));
  377.                 dglDepthMask = reinterpret_cast<glDepthMask_fp>(dll_GetSymbol(OpenGLModuleHandle,"glDepthMask"));
  378.                 dglDisable = reinterpret_cast<glDisable_fp>(dll_GetSymbol(OpenGLModuleHandle,"glDisable"));
  379.                 dglDisableClientState = reinterpret_cast<glDisableClientState_fp>(dll_GetSymbol(OpenGLModuleHandle,"glDisableClientState"));
  380.                 dglDrawArrays = reinterpret_cast<glDrawArrays_fp>(dll_GetSymbol(OpenGLModuleHandle,"glDrawArrays"));
  381.                 dglEnable = reinterpret_cast<glEnable_fp>(dll_GetSymbol(OpenGLModuleHandle,"glEnable"));
  382.                 dglEnableClientState = reinterpret_cast<glEnableClientState_fp>(dll_GetSymbol(OpenGLModuleHandle,"glEnableClientState"));
  383.                 dglEnd = reinterpret_cast<glEnd_fp>(dll_GetSymbol(OpenGLModuleHandle,"glEnd"));
  384.                 dglFinish = reinterpret_cast<glFinish_fp>(dll_GetSymbol(OpenGLModuleHandle,"glFinish"));
  385.                 dglGenTextures = reinterpret_cast<glGenTextures_fp>(dll_GetSymbol(OpenGLModuleHandle,"glGenTextures"));
  386.                 dglGetFloatv = reinterpret_cast<glGetFloatv_fp>(dll_GetSymbol(OpenGLModuleHandle,"glGetFloatv"));
  387.                 dglGetIntegerv = reinterpret_cast<glGetIntegerv_fp>(dll_GetSymbol(OpenGLModuleHandle,"glGetIntegerv"));
  388.                 dglGetString = reinterpret_cast<glGetString_fp>(dll_GetSymbol(OpenGLModuleHandle,"glGetString"));
  389.                 dglGetTexLevelParameteriv = reinterpret_cast<glGetTexLevelParameteriv_fp>(dll_GetSymbol(OpenGLModuleHandle,"glGetTexLevelParameteriv"));
  390.                 dglHint = reinterpret_cast<glHint_fp>(dll_GetSymbol(OpenGLModuleHandle,"glHint"));
  391.                 dglLineWidth = reinterpret_cast<glLineWidth_fp>(dll_GetSymbol(OpenGLModuleHandle,"glLineWidth"));
  392.                 dglLoadIdentity = reinterpret_cast<glLoadIdentity_fp>(dll_GetSymbol(OpenGLModuleHandle,"glLoadIdentity"));
  393.                 dglMatrixMode = reinterpret_cast<glMatrixMode_fp>(dll_GetSymbol(OpenGLModuleHandle,"glMatrixMode"));
  394.                 dglOrtho = reinterpret_cast<glOrtho_fp>(dll_GetSymbol(OpenGLModuleHandle,"glOrtho"));
  395.                 dglPointSize = reinterpret_cast<glPointSize_fp>(dll_GetSymbol(OpenGLModuleHandle,"glPointSize"));
  396.                 dglPopMatrix = reinterpret_cast<glPopMatrix_fp>(dll_GetSymbol(OpenGLModuleHandle,"glPopMatrix"));
  397.                 dglPrioritizeTextures = reinterpret_cast<glPrioritizeTextures_fp>(dll_GetSymbol(OpenGLModuleHandle,"glPrioritizeTextures"));
  398.                 dglPushMatrix = reinterpret_cast<glPushMatrix_fp>(dll_GetSymbol(OpenGLModuleHandle,"glPushMatrix"));
  399.                 dglReadBuffer = reinterpret_cast<glReadBuffer_fp>(dll_GetSymbol(OpenGLModuleHandle,"glReadBuffer"));
  400.                 dglReadPixels = reinterpret_cast<glReadPixels_fp>(dll_GetSymbol(OpenGLModuleHandle,"glReadPixels"));
  401.                 dglScalef = reinterpret_cast<glScalef_fp>(dll_GetSymbol(OpenGLModuleHandle,"glScalef"));
  402.                 dglShadeModel = reinterpret_cast<glShadeModel_fp>(dll_GetSymbol(OpenGLModuleHandle,"glShadeModel"));
  403.                 dglTexCoordPointer = reinterpret_cast<glTexCoordPointer_fp>(dll_GetSymbol(OpenGLModuleHandle,"glTexCoordPointer"));
  404.                 dglTexEnvi = reinterpret_cast<glTexEnvi_fp>(dll_GetSymbol(OpenGLModuleHandle,"glTexEnvi"));
  405.                 dglTexImage2D = reinterpret_cast<glTexImage2D_fp>(dll_GetSymbol(OpenGLModuleHandle,"glTexImage2D"));
  406.                 dglTexParameterf = reinterpret_cast<glTexParameterf_fp>(dll_GetSymbol(OpenGLModuleHandle,"glTexParameterf"));
  407.                 dglTexParameteri = reinterpret_cast<glTexParameteri_fp>(dll_GetSymbol(OpenGLModuleHandle,"glTexParameteri"));
  408.                 dglTranslatef = reinterpret_cast<glTranslatef_fp>(dll_GetSymbol(OpenGLModuleHandle,"glTranslatef"));
  409.                 dglVertexPointer = reinterpret_cast<glVertexPointer_fp>(dll_GetSymbol(OpenGLModuleHandle,"glVertexPointer"));
  410.                 dglViewport = reinterpret_cast<glViewport_fp>(dll_GetSymbol(OpenGLModuleHandle,"glViewport"));
  411.         }
  412.  
  413.         return true;
  414. }
  415.  
  416. static void OpenGL_SetFuncsToNull(void)
  417. {
  418.         dglAlphaFunc = NULL;
  419.         dglBindTexture = NULL;
  420.         dglBlendFunc = NULL;
  421.         dglClear = NULL;
  422.         dglClearColor = NULL;
  423.         dglColor4f = NULL;
  424.         dglColorPointer = NULL;
  425.         dglCullFace = NULL;
  426.         dglDeleteTextures = NULL;
  427.         dglDepthFunc = NULL;
  428.         dglDepthMask = NULL;
  429.         dglDisable = NULL;
  430.         dglDisableClientState = NULL;
  431.         dglDrawArrays = NULL;
  432.         dglEnable = NULL;
  433.         dglEnableClientState = NULL;
  434.         dglEnd = NULL;
  435.         dglFinish = NULL;
  436.         dglGenTextures = NULL;
  437.         dglGetFloatv = NULL;
  438.         dglGetIntegerv = NULL;
  439.         dglGetString = NULL;
  440.         dglGetTexLevelParameteriv = NULL;
  441.         dglHint = NULL;
  442.         dglLineWidth = NULL;
  443.         dglLoadIdentity = NULL;
  444.         dglMatrixMode = NULL;
  445.         dglOrtho = NULL;
  446.         dglPointSize = NULL;
  447.         dglPopMatrix = NULL;
  448.         dglPrioritizeTextures = NULL;
  449.         dglPushMatrix = NULL;
  450.         dglReadBuffer = NULL;
  451.         dglReadPixels = NULL;
  452.         dglScalef = NULL;
  453.         dglShadeModel = NULL;
  454.         dglTexCoordPointer = NULL;
  455.         dglTexEnvi = NULL;
  456.         dglTexImage2D = NULL;
  457.         dglTexParameterf = NULL;
  458.         dglTexParameteri = NULL;
  459.         dglTranslatef = NULL;
  460.         dglVertexPointer = NULL;
  461.         dglViewport = NULL;
  462. }
  463. #endif
  464.  
  465.  
  466. #endif //!__LOADGL_H__
  467.