2008-02-24 00:46:57 +00:00
|
|
|
#include "compat.h"
|
2006-04-23 06:44:19 +00:00
|
|
|
#include "glbuild.h"
|
|
|
|
#include "baselayer.h"
|
|
|
|
|
2006-05-12 21:55:05 +00:00
|
|
|
#if defined USE_OPENGL
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2015-05-16 09:12:12 +00:00
|
|
|
#ifdef RENDERTYPESDL
|
|
|
|
# include "sdlayer.h"
|
|
|
|
#endif
|
|
|
|
|
2016-02-29 06:34:16 +00:00
|
|
|
GLenum BuildGLError;
|
|
|
|
void BuildGLErrorCheck(void)
|
|
|
|
{
|
|
|
|
volatile GLenum err;
|
|
|
|
while ((err = bglGetError()) != GL_NO_ERROR)
|
|
|
|
{
|
|
|
|
BuildGLError = err; // set a watchpoint/breakpoint here
|
|
|
|
}
|
|
|
|
}
|
2015-05-16 09:12:12 +00:00
|
|
|
|
2014-02-10 10:56:14 +00:00
|
|
|
#if defined DYNAMIC_GL
|
|
|
|
|
2015-05-16 09:12:12 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
bwglCreateContextProcPtr bwglCreateContext;
|
|
|
|
bwglDeleteContextProcPtr bwglDeleteContext;
|
|
|
|
bwglGetProcAddressProcPtr bwglGetProcAddress;
|
|
|
|
bwglMakeCurrentProcPtr bwglMakeCurrent;
|
|
|
|
|
|
|
|
bwglSwapBuffersProcPtr bwglSwapBuffers;
|
|
|
|
bwglChoosePixelFormatProcPtr bwglChoosePixelFormat;
|
|
|
|
bwglDescribePixelFormatProcPtr bwglDescribePixelFormat;
|
|
|
|
bwglGetPixelFormatProcPtr bwglGetPixelFormat;
|
|
|
|
bwglSetPixelFormatProcPtr bwglSetPixelFormat;
|
2006-04-23 06:44:19 +00:00
|
|
|
#endif
|
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
bglClearColorProcPtr bglClearColor;
|
|
|
|
bglClearProcPtr bglClear;
|
|
|
|
bglColorMaskProcPtr bglColorMask;
|
|
|
|
bglAlphaFuncProcPtr bglAlphaFunc;
|
|
|
|
bglBlendFuncProcPtr bglBlendFunc;
|
|
|
|
bglCullFaceProcPtr bglCullFace;
|
|
|
|
bglFrontFaceProcPtr bglFrontFace;
|
|
|
|
bglPolygonOffsetProcPtr bglPolygonOffset;
|
|
|
|
bglPolygonModeProcPtr bglPolygonMode;
|
|
|
|
bglEnableProcPtr bglEnable;
|
|
|
|
bglDisableProcPtr bglDisable;
|
|
|
|
bglGetDoublevProcPtr bglGetDoublev;
|
|
|
|
bglGetFloatvProcPtr bglGetFloatv;
|
|
|
|
bglGetIntegervProcPtr bglGetIntegerv;
|
|
|
|
bglPushAttribProcPtr bglPushAttrib;
|
|
|
|
bglPopAttribProcPtr bglPopAttrib;
|
|
|
|
bglGetErrorProcPtr bglGetError;
|
|
|
|
bglGetStringProcPtr bglGetString;
|
|
|
|
bglHintProcPtr bglHint;
|
|
|
|
bglDrawBufferProcPtr bglDrawBuffer;
|
|
|
|
bglReadBufferProcPtr bglReadBuffer;
|
|
|
|
bglScissorProcPtr bglScissor;
|
|
|
|
bglClipPlaneProcPtr bglClipPlane;
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
// Depth
|
2012-11-10 06:09:51 +00:00
|
|
|
bglDepthFuncProcPtr bglDepthFunc;
|
|
|
|
bglDepthMaskProcPtr bglDepthMask;
|
2015-02-11 05:23:04 +00:00
|
|
|
//bglDepthRangeProcPtr bglDepthRange;
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
// Matrix
|
2012-11-10 06:09:51 +00:00
|
|
|
bglMatrixModeProcPtr bglMatrixMode;
|
|
|
|
bglOrthoProcPtr bglOrtho;
|
|
|
|
bglFrustumProcPtr bglFrustum;
|
|
|
|
bglViewportProcPtr bglViewport;
|
|
|
|
bglPushMatrixProcPtr bglPushMatrix;
|
|
|
|
bglPopMatrixProcPtr bglPopMatrix;
|
|
|
|
bglLoadIdentityProcPtr bglLoadIdentity;
|
|
|
|
bglLoadMatrixfProcPtr bglLoadMatrixf;
|
|
|
|
bglLoadMatrixdProcPtr bglLoadMatrixd;
|
|
|
|
bglMultMatrixfProcPtr bglMultMatrixf;
|
|
|
|
bglMultMatrixdProcPtr bglMultMatrixd;
|
|
|
|
bglRotatefProcPtr bglRotatef;
|
|
|
|
bglScalefProcPtr bglScalef;
|
|
|
|
bglTranslatefProcPtr bglTranslatef;
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
// Drawing
|
2012-11-10 06:09:51 +00:00
|
|
|
bglBeginProcPtr bglBegin;
|
|
|
|
bglEndProcPtr bglEnd;
|
|
|
|
bglVertex2fProcPtr bglVertex2f;
|
|
|
|
bglVertex2iProcPtr bglVertex2i;
|
|
|
|
bglVertex3fProcPtr bglVertex3f;
|
|
|
|
bglVertex3dProcPtr bglVertex3d;
|
|
|
|
bglVertex3fvProcPtr bglVertex3fv;
|
|
|
|
bglVertex3dvProcPtr bglVertex3dv;
|
2014-10-25 03:25:35 +00:00
|
|
|
bglRectiProcPtr bglRecti;
|
2014-09-30 04:12:09 +00:00
|
|
|
bglColor3fProcPtr bglColor3f;
|
2012-11-10 06:09:51 +00:00
|
|
|
bglColor4fProcPtr bglColor4f;
|
|
|
|
bglColor4ubProcPtr bglColor4ub;
|
|
|
|
bglTexCoord2dProcPtr bglTexCoord2d;
|
|
|
|
bglTexCoord2fProcPtr bglTexCoord2f;
|
|
|
|
bglTexCoord2iProcPtr bglTexCoord2i;
|
|
|
|
bglNormal3fProcPtr bglNormal3f;
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
// Lighting
|
2012-11-10 06:09:51 +00:00
|
|
|
bglShadeModelProcPtr bglShadeModel;
|
|
|
|
bglLightfvProcPtr bglLightfv;
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
// Raster funcs
|
2012-11-10 06:09:51 +00:00
|
|
|
bglReadPixelsProcPtr bglReadPixels;
|
|
|
|
bglRasterPos4iProcPtr bglRasterPos4i;
|
|
|
|
bglDrawPixelsProcPtr bglDrawPixels;
|
|
|
|
bglPixelStoreiProcPtr bglPixelStorei;
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
// Texture mapping
|
2012-11-10 06:09:51 +00:00
|
|
|
bglTexEnvfProcPtr bglTexEnvf;
|
|
|
|
bglGenTexturesProcPtr bglGenTextures;
|
|
|
|
bglDeleteTexturesProcPtr bglDeleteTextures;
|
|
|
|
bglBindTextureProcPtr bglBindTexture;
|
|
|
|
bglTexImage2DProcPtr bglTexImage2D;
|
|
|
|
bglCopyTexImage2DProcPtr bglCopyTexImage2D;
|
|
|
|
bglCopyTexSubImage2DProcPtr bglCopyTexSubImage2D;
|
|
|
|
bglTexSubImage2DProcPtr bglTexSubImage2D;
|
|
|
|
bglTexParameterfProcPtr bglTexParameterf;
|
|
|
|
bglTexParameteriProcPtr bglTexParameteri;
|
|
|
|
bglGetTexParameterivProcPtr bglGetTexParameteriv;
|
|
|
|
bglGetTexLevelParameterivProcPtr bglGetTexLevelParameteriv;
|
|
|
|
bglTexGenfvProcPtr bglTexGenfv;
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
// Fog
|
2012-11-10 06:09:51 +00:00
|
|
|
bglFogfProcPtr bglFogf;
|
|
|
|
bglFogiProcPtr bglFogi;
|
|
|
|
bglFogfvProcPtr bglFogfv;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
2006-08-30 23:32:39 +00:00
|
|
|
// Display Lists
|
2012-11-10 06:09:51 +00:00
|
|
|
bglNewListProcPtr bglNewList;
|
|
|
|
bglEndListProcPtr bglEndList;
|
|
|
|
bglCallListProcPtr bglCallList;
|
|
|
|
bglDeleteListsProcPtr bglDeleteLists;
|
2006-08-30 23:32:39 +00:00
|
|
|
|
2006-09-27 02:23:27 +00:00
|
|
|
// Vertex Arrays
|
2012-11-10 06:09:51 +00:00
|
|
|
bglEnableClientStateProcPtr bglEnableClientState;
|
|
|
|
bglDisableClientStateProcPtr bglDisableClientState;
|
|
|
|
bglVertexPointerProcPtr bglVertexPointer;
|
|
|
|
bglNormalPointerProcPtr bglNormalPointer;
|
|
|
|
bglTexCoordPointerProcPtr bglTexCoordPointer;
|
|
|
|
bglDrawArraysProcPtr bglDrawArrays;
|
|
|
|
bglDrawElementsProcPtr bglDrawElements;
|
2006-09-27 02:23:27 +00:00
|
|
|
|
2006-10-04 09:54:25 +00:00
|
|
|
// Stencil Buffer
|
2012-11-10 06:09:51 +00:00
|
|
|
bglClearStencilProcPtr bglClearStencil;
|
|
|
|
bglStencilOpProcPtr bglStencilOp;
|
|
|
|
bglStencilFuncProcPtr bglStencilFunc;
|
2006-10-04 09:54:25 +00:00
|
|
|
|
2015-05-16 09:12:12 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined DYNAMIC_GLEXT
|
|
|
|
|
|
|
|
bglBlendEquationProcPtr bglBlendEquation;
|
|
|
|
|
|
|
|
bglTexImage3DProcPtr bglTexImage3D;
|
|
|
|
bglCompressedTexImage2DARBProcPtr bglCompressedTexImage2DARB;
|
|
|
|
bglGetCompressedTexImageARBProcPtr bglGetCompressedTexImageARB;
|
|
|
|
|
2006-12-31 06:32:04 +00:00
|
|
|
// GPU Programs
|
2012-11-10 06:09:51 +00:00
|
|
|
bglGenProgramsARBProcPtr bglGenProgramsARB;
|
|
|
|
bglBindProgramARBProcPtr bglBindProgramARB;
|
|
|
|
bglProgramStringARBProcPtr bglProgramStringARB;
|
|
|
|
bglDeleteProgramsARBProcPtr bglDeleteProgramsARB;
|
2006-12-31 06:32:04 +00:00
|
|
|
|
|
|
|
// Multitexturing
|
2012-11-10 06:09:51 +00:00
|
|
|
bglActiveTextureARBProcPtr bglActiveTextureARB;
|
|
|
|
bglClientActiveTextureARBProcPtr bglClientActiveTextureARB;
|
|
|
|
bglMultiTexCoord2dARBProcPtr bglMultiTexCoord2dARB;
|
|
|
|
bglMultiTexCoord2fARBProcPtr bglMultiTexCoord2fARB;
|
2006-12-31 06:32:04 +00:00
|
|
|
|
2007-01-06 01:29:45 +00:00
|
|
|
// Frame Buffer Objects
|
2012-11-10 06:09:51 +00:00
|
|
|
bglGenFramebuffersEXTProcPtr bglGenFramebuffersEXT;
|
|
|
|
bglBindFramebufferEXTProcPtr bglBindFramebufferEXT;
|
|
|
|
bglFramebufferTexture2DEXTProcPtr bglFramebufferTexture2DEXT;
|
|
|
|
bglCheckFramebufferStatusEXTProcPtr bglCheckFramebufferStatusEXT;
|
|
|
|
bglDeleteFramebuffersEXTProcPtr bglDeleteFramebuffersEXT;
|
2007-12-12 17:42:14 +00:00
|
|
|
|
|
|
|
// Vertex Buffer Objects
|
2012-11-10 06:09:51 +00:00
|
|
|
bglGenBuffersARBProcPtr bglGenBuffersARB;
|
|
|
|
bglBindBufferARBProcPtr bglBindBufferARB;
|
|
|
|
bglDeleteBuffersARBProcPtr bglDeleteBuffersARB;
|
|
|
|
bglBufferDataARBProcPtr bglBufferDataARB;
|
|
|
|
bglBufferSubDataARBProcPtr bglBufferSubDataARB;
|
|
|
|
bglMapBufferARBProcPtr bglMapBufferARB;
|
|
|
|
bglUnmapBufferARBProcPtr bglUnmapBufferARB;
|
2007-01-06 01:29:45 +00:00
|
|
|
|
2015-07-15 08:23:00 +00:00
|
|
|
// ARB_buffer_storage
|
|
|
|
bglBufferStorageProcPtr bglBufferStorage;
|
|
|
|
|
|
|
|
// ARB_map_buffer_range
|
|
|
|
bglMapBufferRangeProcPtr bglMapBufferRange;
|
|
|
|
|
2008-03-26 09:24:25 +00:00
|
|
|
// Occlusion queries
|
2012-11-10 06:09:51 +00:00
|
|
|
bglGenQueriesARBProcPtr bglGenQueriesARB;
|
|
|
|
bglDeleteQueriesARBProcPtr bglDeleteQueriesARB;
|
|
|
|
bglIsQueryARBProcPtr bglIsQueryARB;
|
|
|
|
bglBeginQueryARBProcPtr bglBeginQueryARB;
|
|
|
|
bglEndQueryARBProcPtr bglEndQueryARB;
|
|
|
|
bglGetQueryivARBProcPtr bglGetQueryivARB;
|
|
|
|
bglGetQueryObjectivARBProcPtr bglGetQueryObjectivARB;
|
|
|
|
bglGetQueryObjectuivARBProcPtr bglGetQueryObjectuivARB;
|
2008-03-26 09:24:25 +00:00
|
|
|
|
2008-11-16 21:46:11 +00:00
|
|
|
// Shader Objects
|
2012-11-10 06:09:51 +00:00
|
|
|
bglDeleteObjectARBProcPtr bglDeleteObjectARB;
|
|
|
|
bglGetHandleARBProcPtr bglGetHandleARB;
|
|
|
|
bglDetachObjectARBProcPtr bglDetachObjectARB;
|
|
|
|
bglCreateShaderObjectARBProcPtr bglCreateShaderObjectARB;
|
|
|
|
bglShaderSourceARBProcPtr bglShaderSourceARB;
|
|
|
|
bglCompileShaderARBProcPtr bglCompileShaderARB;
|
|
|
|
bglCreateProgramObjectARBProcPtr bglCreateProgramObjectARB;
|
|
|
|
bglAttachObjectARBProcPtr bglAttachObjectARB;
|
|
|
|
bglLinkProgramARBProcPtr bglLinkProgramARB;
|
|
|
|
bglUseProgramObjectARBProcPtr bglUseProgramObjectARB;
|
|
|
|
bglValidateProgramARBProcPtr bglValidateProgramARB;
|
|
|
|
bglUniform1fARBProcPtr bglUniform1fARB;
|
|
|
|
bglUniform2fARBProcPtr bglUniform2fARB;
|
|
|
|
bglUniform3fARBProcPtr bglUniform3fARB;
|
|
|
|
bglUniform4fARBProcPtr bglUniform4fARB;
|
|
|
|
bglUniform1iARBProcPtr bglUniform1iARB;
|
|
|
|
bglUniform2iARBProcPtr bglUniform2iARB;
|
|
|
|
bglUniform3iARBProcPtr bglUniform3iARB;
|
|
|
|
bglUniform4iARBProcPtr bglUniform4iARB;
|
|
|
|
bglUniform1fvARBProcPtr bglUniform1fvARB;
|
|
|
|
bglUniform2fvARBProcPtr bglUniform2fvARB;
|
|
|
|
bglUniform3fvARBProcPtr bglUniform3fvARB;
|
|
|
|
bglUniform4fvARBProcPtr bglUniform4fvARB;
|
|
|
|
bglUniform1ivARBProcPtr bglUniform1ivARB;
|
|
|
|
bglUniform2ivARBProcPtr bglUniform2ivARB;
|
|
|
|
bglUniform3ivARBProcPtr bglUniform3ivARB;
|
|
|
|
bglUniform4ivARBProcPtr bglUniform4ivARB;
|
|
|
|
bglUniformMatrix2fvARBProcPtr bglUniformMatrix2fvARB;
|
|
|
|
bglUniformMatrix3fvARBProcPtr bglUniformMatrix3fvARB;
|
|
|
|
bglUniformMatrix4fvARBProcPtr bglUniformMatrix4fvARB;
|
|
|
|
bglGetObjectParameterfvARBProcPtr bglGetObjectParameterfvARB;
|
|
|
|
bglGetObjectParameterivARBProcPtr bglGetObjectParameterivARB;
|
|
|
|
bglGetInfoLogARBProcPtr bglGetInfoLogARB;
|
|
|
|
bglGetAttachedObjectsARBProcPtr bglGetAttachedObjectsARB;
|
|
|
|
bglGetUniformLocationARBProcPtr bglGetUniformLocationARB;
|
|
|
|
bglGetActiveUniformARBProcPtr bglGetActiveUniformARB;
|
|
|
|
bglGetUniformfvARBProcPtr bglGetUniformfvARB;
|
|
|
|
bglGetUniformivARBProcPtr bglGetUniformivARB;
|
|
|
|
bglGetShaderSourceARBProcPtr bglGetShaderSourceARB;
|
2008-11-16 21:46:11 +00:00
|
|
|
|
2008-11-16 22:56:55 +00:00
|
|
|
// Vertex Shaders
|
2012-11-10 06:09:51 +00:00
|
|
|
bglVertexAttrib1dARBProcPtr bglVertexAttrib1dARB;
|
|
|
|
bglVertexAttrib1dvARBProcPtr bglVertexAttrib1dvARB;
|
|
|
|
bglVertexAttrib1fARBProcPtr bglVertexAttrib1fARB;
|
|
|
|
bglVertexAttrib1fvARBProcPtr bglVertexAttrib1fvARB;
|
|
|
|
bglVertexAttrib1sARBProcPtr bglVertexAttrib1sARB;
|
|
|
|
bglVertexAttrib1svARBProcPtr bglVertexAttrib1svARB;
|
|
|
|
bglVertexAttrib2dARBProcPtr bglVertexAttrib2dARB;
|
|
|
|
bglVertexAttrib2dvARBProcPtr bglVertexAttrib2dvARB;
|
|
|
|
bglVertexAttrib2fARBProcPtr bglVertexAttrib2fARB;
|
|
|
|
bglVertexAttrib2fvARBProcPtr bglVertexAttrib2fvARB;
|
|
|
|
bglVertexAttrib2sARBProcPtr bglVertexAttrib2sARB;
|
|
|
|
bglVertexAttrib2svARBProcPtr bglVertexAttrib2svARB;
|
|
|
|
bglVertexAttrib3dARBProcPtr bglVertexAttrib3dARB;
|
|
|
|
bglVertexAttrib3dvARBProcPtr bglVertexAttrib3dvARB;
|
|
|
|
bglVertexAttrib3fARBProcPtr bglVertexAttrib3fARB;
|
|
|
|
bglVertexAttrib3fvARBProcPtr bglVertexAttrib3fvARB;
|
|
|
|
bglVertexAttrib3sARBProcPtr bglVertexAttrib3sARB;
|
|
|
|
bglVertexAttrib3svARBProcPtr bglVertexAttrib3svARB;
|
|
|
|
bglVertexAttrib4NbvARBProcPtr bglVertexAttrib4NbvARB;
|
|
|
|
bglVertexAttrib4NivARBProcPtr bglVertexAttrib4NivARB;
|
|
|
|
bglVertexAttrib4NsvARBProcPtr bglVertexAttrib4NsvARB;
|
|
|
|
bglVertexAttrib4NubARBProcPtr bglVertexAttrib4NubARB;
|
|
|
|
bglVertexAttrib4NubvARBProcPtr bglVertexAttrib4NubvARB;
|
|
|
|
bglVertexAttrib4NuivARBProcPtr bglVertexAttrib4NuivARB;
|
|
|
|
bglVertexAttrib4NusvARBProcPtr bglVertexAttrib4NusvARB;
|
|
|
|
bglVertexAttrib4bvARBProcPtr bglVertexAttrib4bvARB;
|
|
|
|
bglVertexAttrib4dARBProcPtr bglVertexAttrib4dARB;
|
|
|
|
bglVertexAttrib4dvARBProcPtr bglVertexAttrib4dvARB;
|
|
|
|
bglVertexAttrib4fARBProcPtr bglVertexAttrib4fARB;
|
|
|
|
bglVertexAttrib4fvARBProcPtr bglVertexAttrib4fvARB;
|
|
|
|
bglVertexAttrib4ivARBProcPtr bglVertexAttrib4ivARB;
|
|
|
|
bglVertexAttrib4sARBProcPtr bglVertexAttrib4sARB;
|
|
|
|
bglVertexAttrib4svARBProcPtr bglVertexAttrib4svARB;
|
|
|
|
bglVertexAttrib4ubvARBProcPtr bglVertexAttrib4ubvARB;
|
|
|
|
bglVertexAttrib4uivARBProcPtr bglVertexAttrib4uivARB;
|
|
|
|
bglVertexAttrib4usvARBProcPtr bglVertexAttrib4usvARB;
|
|
|
|
bglVertexAttribPointerARBProcPtr bglVertexAttribPointerARB;
|
|
|
|
bglEnableVertexAttribArrayARBProcPtr bglEnableVertexAttribArrayARB;
|
|
|
|
bglDisableVertexAttribArrayARBProcPtr bglDisableVertexAttribArrayARB;
|
|
|
|
bglGetVertexAttribdvARBProcPtr bglGetVertexAttribdvARB;
|
|
|
|
bglGetVertexAttribfvARBProcPtr bglGetVertexAttribfvARB;
|
|
|
|
bglGetVertexAttribivARBProcPtr bglGetVertexAttribivARB;
|
|
|
|
bglGetVertexAttribPointervARBProcPtr bglGetVertexAttribPointervARB;
|
|
|
|
bglBindAttribLocationARBProcPtr bglBindAttribLocationARB;
|
|
|
|
bglGetActiveAttribARBProcPtr bglGetActiveAttribARB;
|
|
|
|
bglGetAttribLocationARBProcPtr bglGetAttribLocationARB;
|
2008-11-16 22:56:55 +00:00
|
|
|
|
2011-10-02 05:56:35 +00:00
|
|
|
// Debug Output
|
2011-10-11 16:52:53 +00:00
|
|
|
#ifndef __APPLE__
|
2012-11-10 06:09:51 +00:00
|
|
|
bglDebugMessageControlARBProcPtr bglDebugMessageControlARB;
|
|
|
|
bglDebugMessageCallbackARBProcPtr bglDebugMessageCallbackARB;
|
2011-10-11 16:52:53 +00:00
|
|
|
#endif
|
2011-10-02 05:56:35 +00:00
|
|
|
|
2015-05-16 09:12:12 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
bwglSwapIntervalEXTProcPtr bwglSwapIntervalEXT;
|
|
|
|
bwglCreateContextAttribsARBProcPtr bwglCreateContextAttribsARB;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined DYNAMIC_GLU
|
|
|
|
|
2007-01-16 03:19:04 +00:00
|
|
|
// GLU
|
2012-11-10 06:09:51 +00:00
|
|
|
bgluTessBeginContourProcPtr bgluTessBeginContour;
|
|
|
|
bgluTessBeginPolygonProcPtr bgluTessBeginPolygon;
|
|
|
|
bgluTessCallbackProcPtr bgluTessCallback;
|
|
|
|
bgluTessEndContourProcPtr bgluTessEndContour;
|
|
|
|
bgluTessEndPolygonProcPtr bgluTessEndPolygon;
|
|
|
|
bgluTessNormalProcPtr bgluTessNormal;
|
|
|
|
bgluTessPropertyProcPtr bgluTessProperty;
|
|
|
|
bgluTessVertexProcPtr bgluTessVertex;
|
|
|
|
bgluNewTessProcPtr bgluNewTess;
|
|
|
|
bgluDeleteTessProcPtr bgluDeleteTess;
|
2007-07-01 06:32:03 +00:00
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
bgluPerspectiveProcPtr bgluPerspective;
|
2007-07-01 06:32:03 +00:00
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
bgluErrorStringProcPtr bgluErrorString;
|
2007-01-16 03:19:04 +00:00
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
bgluProjectProcPtr bgluProject;
|
|
|
|
bgluUnProjectProcPtr bgluUnProject;
|
2009-07-11 22:20:15 +00:00
|
|
|
|
2015-05-16 09:12:12 +00:00
|
|
|
#endif
|
2007-07-01 06:32:03 +00:00
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
|
2015-05-16 09:12:12 +00:00
|
|
|
#if defined DYNAMIC_GL || defined DYNAMIC_GLEXT || defined DYNAMIC_GLU
|
|
|
|
# if !defined _WIN32
|
|
|
|
# include <dlfcn.h>
|
|
|
|
# endif
|
2013-10-07 10:06:09 +00:00
|
|
|
#endif
|
|
|
|
|
2015-05-16 09:12:12 +00:00
|
|
|
#if defined DYNAMIC_GL || defined DYNAMIC_GLEXT
|
|
|
|
|
2013-10-07 10:06:09 +00:00
|
|
|
#if !defined RENDERTYPESDL && defined _WIN32
|
|
|
|
static HMODULE hGLDLL;
|
|
|
|
#endif
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2015-05-16 09:12:12 +00:00
|
|
|
char *gldriver = NULL;
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2011-01-16 02:50:27 +00:00
|
|
|
static void *getproc_(const char *s, int32_t *err, int32_t fatal, int32_t extension)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
void *t;
|
2006-04-23 06:44:19 +00:00
|
|
|
#if defined RENDERTYPESDL
|
2008-03-23 00:06:42 +00:00
|
|
|
UNREFERENCED_PARAMETER(extension);
|
2011-01-16 02:50:27 +00:00
|
|
|
t = (void *)SDL_GL_GetProcAddress(s);
|
2006-04-23 06:44:19 +00:00
|
|
|
#elif defined _WIN32
|
2011-01-16 02:50:27 +00:00
|
|
|
if (extension) t = (void *)bwglGetProcAddress(s);
|
|
|
|
else t = (void *)GetProcAddress(hGLDLL,s);
|
2006-04-23 06:44:19 +00:00
|
|
|
#else
|
|
|
|
#error Need a dynamic loader for this platform...
|
|
|
|
#endif
|
2007-12-12 17:42:14 +00:00
|
|
|
if (!t && fatal)
|
|
|
|
{
|
2006-04-24 19:04:22 +00:00
|
|
|
initprintf("Failed to find %s in %s\n", s, gldriver);
|
|
|
|
*err = 1;
|
|
|
|
}
|
|
|
|
return t;
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
#define GETPROC(s) getproc_(s,&err,1,0)
|
|
|
|
#define GETPROCSOFT(s) getproc_(s,&err,0,0)
|
|
|
|
#define GETPROCEXT(s) getproc_(s,&err,1,1)
|
|
|
|
#define GETPROCEXTSOFT(s) getproc_(s,&err,0,1)
|
|
|
|
|
2015-05-16 09:12:12 +00:00
|
|
|
#endif
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t loadgldriver(const char *driver)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2015-05-16 09:12:12 +00:00
|
|
|
#if defined EDUKE32_GLES
|
|
|
|
jwzgles_reset();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined DYNAMIC_GL || defined DYNAMIC_GLEXT
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t err=0;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
2013-10-07 10:06:09 +00:00
|
|
|
#if !defined RENDERTYPESDL && defined _WIN32
|
2006-04-24 19:04:22 +00:00
|
|
|
if (hGLDLL) return 0;
|
2006-04-23 06:44:19 +00:00
|
|
|
#endif
|
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
if (!driver)
|
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
#ifdef _WIN32
|
2008-08-22 23:10:54 +00:00
|
|
|
driver = "opengl32.dll";
|
2015-05-16 20:16:27 +00:00
|
|
|
#elif defined EDUKE32_OSX
|
2006-08-31 01:56:43 +00:00
|
|
|
driver = "/System/Library/Frameworks/OpenGL.framework/OpenGL";
|
2014-07-22 11:18:59 +00:00
|
|
|
#elif defined __OpenBSD__
|
|
|
|
driver = "libGL.so";
|
2006-04-23 06:44:19 +00:00
|
|
|
#else
|
2008-06-11 02:33:23 +00:00
|
|
|
driver = "libGL.so.1";
|
2006-04-23 06:44:19 +00:00
|
|
|
#endif
|
2006-04-24 19:04:22 +00:00
|
|
|
}
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2015-05-16 20:16:27 +00:00
|
|
|
#if defined RENDERTYPESDL && !defined EDUKE32_IOS
|
2013-10-07 10:06:09 +00:00
|
|
|
if (SDL_GL_LoadLibrary(driver))
|
|
|
|
{
|
|
|
|
initprintf("Failed loading \"%s\": %s\n", driver, SDL_GetError());
|
|
|
|
return -1;
|
|
|
|
}
|
2006-04-23 06:44:19 +00:00
|
|
|
#elif defined _WIN32
|
2006-04-24 19:04:22 +00:00
|
|
|
hGLDLL = LoadLibrary(driver);
|
2013-10-07 10:06:09 +00:00
|
|
|
if (!hGLDLL)
|
|
|
|
{
|
|
|
|
initprintf("Failed loading \"%s\"\n", driver);
|
|
|
|
return -1;
|
|
|
|
}
|
2006-04-23 06:44:19 +00:00
|
|
|
#endif
|
2009-10-07 06:47:35 +00:00
|
|
|
gldriver = Bstrdup(driver);
|
2015-05-16 09:12:12 +00:00
|
|
|
#endif
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2015-05-16 09:12:12 +00:00
|
|
|
#if defined DYNAMIC_GL
|
2012-11-24 09:13:29 +00:00
|
|
|
#ifdef _WIN32
|
2012-11-10 06:09:51 +00:00
|
|
|
bwglCreateContext = (bwglCreateContextProcPtr) GETPROC("wglCreateContext");
|
|
|
|
bwglDeleteContext = (bwglDeleteContextProcPtr) GETPROC("wglDeleteContext");
|
|
|
|
bwglGetProcAddress = (bwglGetProcAddressProcPtr) GETPROC("wglGetProcAddress");
|
|
|
|
bwglMakeCurrent = (bwglMakeCurrentProcPtr) GETPROC("wglMakeCurrent");
|
|
|
|
|
|
|
|
bwglSwapBuffers = (bwglSwapBuffersProcPtr) GETPROC("wglSwapBuffers");
|
|
|
|
bwglChoosePixelFormat = (bwglChoosePixelFormatProcPtr) GETPROC("wglChoosePixelFormat");
|
|
|
|
bwglDescribePixelFormat = (bwglDescribePixelFormatProcPtr) GETPROC("wglDescribePixelFormat");
|
|
|
|
bwglGetPixelFormat = (bwglGetPixelFormatProcPtr) GETPROC("wglGetPixelFormat");
|
|
|
|
bwglSetPixelFormat = (bwglSetPixelFormatProcPtr) GETPROC("wglSetPixelFormat");
|
2006-04-23 06:44:19 +00:00
|
|
|
#endif
|
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
bglClearColor = (bglClearColorProcPtr) GETPROC("glClearColor");
|
|
|
|
bglClear = (bglClearProcPtr) GETPROC("glClear");
|
|
|
|
bglColorMask = (bglColorMaskProcPtr) GETPROC("glColorMask");
|
|
|
|
bglAlphaFunc = (bglAlphaFuncProcPtr) GETPROC("glAlphaFunc");
|
|
|
|
bglBlendFunc = (bglBlendFuncProcPtr) GETPROC("glBlendFunc");
|
|
|
|
bglCullFace = (bglCullFaceProcPtr) GETPROC("glCullFace");
|
|
|
|
bglFrontFace = (bglFrontFaceProcPtr) GETPROC("glFrontFace");
|
|
|
|
bglPolygonOffset = (bglPolygonOffsetProcPtr) GETPROC("glPolygonOffset");
|
|
|
|
bglPolygonMode = (bglPolygonModeProcPtr) GETPROC("glPolygonMode");
|
|
|
|
bglEnable = (bglEnableProcPtr) GETPROC("glEnable");
|
|
|
|
bglDisable = (bglDisableProcPtr) GETPROC("glDisable");
|
|
|
|
bglGetDoublev = (bglGetDoublevProcPtr) GETPROC("glGetDoublev");
|
|
|
|
bglGetFloatv = (bglGetFloatvProcPtr) GETPROC("glGetFloatv");
|
|
|
|
bglGetIntegerv = (bglGetIntegervProcPtr) GETPROC("glGetIntegerv");
|
|
|
|
bglPushAttrib = (bglPushAttribProcPtr) GETPROC("glPushAttrib");
|
|
|
|
bglPopAttrib = (bglPopAttribProcPtr) GETPROC("glPopAttrib");
|
|
|
|
bglGetError = (bglGetErrorProcPtr) GETPROC("glGetError");
|
|
|
|
bglGetString = (bglGetStringProcPtr) GETPROC("glGetString");
|
|
|
|
bglHint = (bglHintProcPtr) GETPROC("glHint");
|
|
|
|
bglDrawBuffer = (bglDrawBufferProcPtr) GETPROC("glDrawBuffer");
|
|
|
|
bglReadBuffer = (bglReadBufferProcPtr) GETPROC("glDrawBuffer");
|
|
|
|
bglScissor = (bglScissorProcPtr) GETPROC("glScissor");
|
|
|
|
bglClipPlane = (bglClipPlaneProcPtr) GETPROC("glClipPlane");
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Depth
|
2012-11-10 06:09:51 +00:00
|
|
|
bglDepthFunc = (bglDepthFuncProcPtr) GETPROC("glDepthFunc");
|
|
|
|
bglDepthMask = (bglDepthMaskProcPtr) GETPROC("glDepthMask");
|
2015-02-11 05:23:04 +00:00
|
|
|
// bglDepthRange = (bglDepthRangeProcPtr) GETPROC("glDepthRange");
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Matrix
|
2012-11-10 06:09:51 +00:00
|
|
|
bglMatrixMode = (bglMatrixModeProcPtr) GETPROC("glMatrixMode");
|
|
|
|
bglOrtho = (bglOrthoProcPtr) GETPROC("glOrtho");
|
|
|
|
bglFrustum = (bglFrustumProcPtr) GETPROC("glFrustum");
|
|
|
|
bglViewport = (bglViewportProcPtr) GETPROC("glViewport");
|
|
|
|
bglPushMatrix = (bglPushMatrixProcPtr) GETPROC("glPushMatrix");
|
|
|
|
bglPopMatrix = (bglPopMatrixProcPtr) GETPROC("glPopMatrix");
|
|
|
|
bglLoadIdentity = (bglLoadIdentityProcPtr) GETPROC("glLoadIdentity");
|
|
|
|
bglLoadMatrixf = (bglLoadMatrixfProcPtr) GETPROC("glLoadMatrixf");
|
|
|
|
bglLoadMatrixd = (bglLoadMatrixdProcPtr) GETPROC("glLoadMatrixd");
|
|
|
|
bglMultMatrixf = (bglMultMatrixfProcPtr) GETPROC("glMultMatrixf");
|
|
|
|
bglMultMatrixd = (bglMultMatrixdProcPtr) GETPROC("glMultMatrixd");
|
|
|
|
bglRotatef = (bglRotatefProcPtr) GETPROC("glRotatef");
|
|
|
|
bglScalef = (bglScalefProcPtr) GETPROC("glScalef");
|
|
|
|
bglTranslatef = (bglTranslatefProcPtr) GETPROC("glTranslatef");
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Drawing
|
2012-11-10 06:09:51 +00:00
|
|
|
bglBegin = (bglBeginProcPtr) GETPROC("glBegin");
|
|
|
|
bglEnd = (bglEndProcPtr) GETPROC("glEnd");
|
|
|
|
bglVertex2f = (bglVertex2fProcPtr) GETPROC("glVertex2f");
|
|
|
|
bglVertex2i = (bglVertex2iProcPtr) GETPROC("glVertex2i");
|
|
|
|
bglVertex3f = (bglVertex3fProcPtr) GETPROC("glVertex3f");
|
|
|
|
bglVertex3d = (bglVertex3dProcPtr) GETPROC("glVertex3d");
|
|
|
|
bglVertex3fv = (bglVertex3fvProcPtr) GETPROC("glVertex3fv");
|
|
|
|
bglVertex3dv = (bglVertex3dvProcPtr) GETPROC("glVertex3dv");
|
2014-10-25 03:25:35 +00:00
|
|
|
bglRecti = (bglRectiProcPtr) GETPROC("glRecti");
|
2014-09-30 04:12:09 +00:00
|
|
|
bglColor3f = (bglColor3fProcPtr) GETPROC("glColor3f");
|
2012-11-10 06:09:51 +00:00
|
|
|
bglColor4f = (bglColor4fProcPtr) GETPROC("glColor4f");
|
|
|
|
bglColor4ub = (bglColor4ubProcPtr) GETPROC("glColor4ub");
|
|
|
|
bglTexCoord2d = (bglTexCoord2dProcPtr) GETPROC("glTexCoord2d");
|
|
|
|
bglTexCoord2f = (bglTexCoord2fProcPtr) GETPROC("glTexCoord2f");
|
|
|
|
bglTexCoord2i = (bglTexCoord2iProcPtr) GETPROC("glTexCoord2i");
|
|
|
|
bglNormal3f = (bglNormal3fProcPtr) GETPROC("glNormal3f");
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Lighting
|
2012-11-10 06:09:51 +00:00
|
|
|
bglShadeModel = (bglShadeModelProcPtr) GETPROC("glShadeModel");
|
|
|
|
bglLightfv = (bglLightfvProcPtr) GETPROC("glLightfv");
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Raster funcs
|
2012-11-10 06:09:51 +00:00
|
|
|
bglReadPixels = (bglReadPixelsProcPtr) GETPROC("glReadPixels");
|
|
|
|
bglRasterPos4i = (bglRasterPos4iProcPtr) GETPROC("glRasterPos4i");
|
|
|
|
bglDrawPixels = (bglDrawPixelsProcPtr) GETPROC("glDrawPixels");
|
|
|
|
bglPixelStorei = (bglPixelStoreiProcPtr) GETPROC("glPixelStorei");
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Texture mapping
|
2012-11-10 06:09:51 +00:00
|
|
|
bglTexEnvf = (bglTexEnvfProcPtr) GETPROC("glTexEnvf");
|
|
|
|
bglGenTextures = (bglGenTexturesProcPtr) GETPROC("glGenTextures");
|
|
|
|
bglDeleteTextures = (bglDeleteTexturesProcPtr) GETPROC("glDeleteTextures");
|
|
|
|
bglBindTexture = (bglBindTextureProcPtr) GETPROC("glBindTexture");
|
|
|
|
bglTexImage2D = (bglTexImage2DProcPtr) GETPROC("glTexImage2D");
|
|
|
|
bglCopyTexImage2D = (bglCopyTexImage2DProcPtr) GETPROC("glCopyTexImage2D");
|
|
|
|
bglCopyTexSubImage2D = (bglCopyTexSubImage2DProcPtr) GETPROC("glCopyTexSubImage2D");
|
|
|
|
bglTexSubImage2D = (bglTexSubImage2DProcPtr) GETPROC("glTexSubImage2D");
|
|
|
|
bglTexParameterf = (bglTexParameterfProcPtr) GETPROC("glTexParameterf");
|
|
|
|
bglTexParameteri = (bglTexParameteriProcPtr) GETPROC("glTexParameteri");
|
|
|
|
bglGetTexParameteriv = (bglGetTexParameterivProcPtr) GETPROC("glGetTexParameteriv");
|
|
|
|
bglGetTexLevelParameteriv = (bglGetTexLevelParameterivProcPtr) GETPROC("glGetTexLevelParameteriv");
|
|
|
|
bglTexGenfv = (bglTexGenfvProcPtr) GETPROC("glTexGenfv");
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Fog
|
2012-11-10 06:09:51 +00:00
|
|
|
bglFogf = (bglFogfProcPtr) GETPROC("glFogf");
|
|
|
|
bglFogi = (bglFogiProcPtr) GETPROC("glFogi");
|
|
|
|
bglFogfv = (bglFogfvProcPtr) GETPROC("glFogfv");
|
2006-04-24 19:04:22 +00:00
|
|
|
|
2006-08-30 23:32:39 +00:00
|
|
|
// Display Lists
|
2012-11-10 06:09:51 +00:00
|
|
|
bglNewList = (bglNewListProcPtr) GETPROC("glNewList");
|
|
|
|
bglEndList = (bglEndListProcPtr) GETPROC("glEndList");
|
|
|
|
bglCallList = (bglCallListProcPtr) GETPROC("glCallList");
|
|
|
|
bglDeleteLists = (bglDeleteListsProcPtr) GETPROC("glDeleteLists");
|
2006-08-30 23:32:39 +00:00
|
|
|
|
2006-09-27 02:23:27 +00:00
|
|
|
// Vertex Arrays
|
2012-11-10 06:09:51 +00:00
|
|
|
bglEnableClientState = (bglEnableClientStateProcPtr) GETPROC("glEnableClientState");
|
|
|
|
bglDisableClientState = (bglDisableClientStateProcPtr) GETPROC("glDisableClientState");
|
|
|
|
bglVertexPointer = (bglVertexPointerProcPtr) GETPROC("glVertexPointer");
|
|
|
|
bglNormalPointer = (bglNormalPointerProcPtr) GETPROC("glNormalPointer");
|
|
|
|
bglTexCoordPointer = (bglTexCoordPointerProcPtr) GETPROC("glTexCoordPointer");
|
|
|
|
bglDrawArrays = (bglDrawArraysProcPtr) GETPROC("glDrawArrays");
|
|
|
|
bglDrawElements = (bglDrawElementsProcPtr) GETPROC("glDrawElements");
|
2006-09-27 02:23:27 +00:00
|
|
|
|
2006-10-04 09:54:25 +00:00
|
|
|
// Stencil Buffer
|
2012-11-10 06:09:51 +00:00
|
|
|
bglClearStencil = (bglClearStencilProcPtr) GETPROC("glClearStencil");
|
|
|
|
bglStencilOp = (bglStencilOpProcPtr) GETPROC("glStencilOp");
|
|
|
|
bglStencilFunc = (bglStencilFuncProcPtr) GETPROC("glStencilFunc");
|
2015-05-16 09:12:12 +00:00
|
|
|
#endif
|
2007-12-12 17:42:14 +00:00
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
loadglextensions();
|
2007-01-20 03:10:32 +00:00
|
|
|
loadglulibrary(getenv("BUILD_GLULIB"));
|
2006-04-24 19:04:22 +00:00
|
|
|
|
2015-05-16 09:12:12 +00:00
|
|
|
#if defined DYNAMIC_GL || defined DYNAMIC_GLEXT
|
2006-04-24 19:04:22 +00:00
|
|
|
if (err) unloadgldriver();
|
|
|
|
return err;
|
2015-05-16 09:12:12 +00:00
|
|
|
#else
|
|
|
|
UNREFERENCED_PARAMETER(driver);
|
|
|
|
return 0;
|
|
|
|
#endif
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t loadglextensions(void)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2015-05-16 09:12:12 +00:00
|
|
|
#if defined DYNAMIC_GLEXT
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t err = 0;
|
2013-10-07 10:06:09 +00:00
|
|
|
#if !defined RENDERTYPESDL && defined _WIN32
|
2006-04-24 19:04:22 +00:00
|
|
|
if (!hGLDLL) return 0;
|
2006-04-23 06:44:19 +00:00
|
|
|
#endif
|
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
bglBlendEquation = (bglBlendEquationProcPtr) GETPROCEXTSOFT("glBlendEquation");
|
2012-10-21 04:52:43 +00:00
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
bglTexImage3D = (bglTexImage3DProcPtr) GETPROCEXTSOFT("glTexImage3D");
|
|
|
|
bglCompressedTexImage2DARB = (bglCompressedTexImage2DARBProcPtr) GETPROCEXTSOFT("glCompressedTexImage2DARB");
|
|
|
|
bglGetCompressedTexImageARB = (bglGetCompressedTexImageARBProcPtr) GETPROCEXTSOFT("glGetCompressedTexImageARB");
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2006-12-31 06:32:04 +00:00
|
|
|
// GPU Programs
|
2012-11-10 06:09:51 +00:00
|
|
|
bglGenProgramsARB = (bglGenProgramsARBProcPtr) GETPROCEXTSOFT("glGenProgramsARB");
|
|
|
|
bglBindProgramARB = (bglBindProgramARBProcPtr) GETPROCEXTSOFT("glBindProgramARB");
|
|
|
|
bglProgramStringARB = (bglProgramStringARBProcPtr) GETPROCEXTSOFT("glProgramStringARB");
|
|
|
|
bglDeleteProgramsARB = (bglDeleteProgramsARBProcPtr) GETPROCEXTSOFT("glDeleteProgramsARB");
|
2006-12-31 06:32:04 +00:00
|
|
|
|
|
|
|
// Multitexturing
|
2012-11-10 06:09:51 +00:00
|
|
|
bglActiveTextureARB = (bglActiveTextureARBProcPtr) GETPROCEXTSOFT("glActiveTextureARB");
|
|
|
|
bglClientActiveTextureARB = (bglClientActiveTextureARBProcPtr) GETPROCEXTSOFT("glClientActiveTextureARB");
|
|
|
|
bglMultiTexCoord2dARB = (bglMultiTexCoord2dARBProcPtr) GETPROCEXTSOFT("glMultiTexCoord2dARB");
|
|
|
|
bglMultiTexCoord2fARB = (bglMultiTexCoord2fARBProcPtr) GETPROCEXTSOFT("glMultiTexCoord2fARB");
|
2006-12-31 06:32:04 +00:00
|
|
|
|
2007-01-06 01:29:45 +00:00
|
|
|
// Frame Buffer Objects
|
2012-11-10 06:09:51 +00:00
|
|
|
bglGenFramebuffersEXT = (bglGenFramebuffersEXTProcPtr) GETPROCEXTSOFT("glGenFramebuffersEXT");
|
|
|
|
bglBindFramebufferEXT = (bglBindFramebufferEXTProcPtr) GETPROCEXTSOFT("glBindFramebufferEXT");
|
|
|
|
bglFramebufferTexture2DEXT = (bglFramebufferTexture2DEXTProcPtr) GETPROCEXTSOFT("glFramebufferTexture2DEXT");
|
|
|
|
bglCheckFramebufferStatusEXT = (bglCheckFramebufferStatusEXTProcPtr) GETPROCEXTSOFT("glCheckFramebufferStatusEXT");
|
|
|
|
bglDeleteFramebuffersEXT = (bglDeleteFramebuffersEXTProcPtr) GETPROCEXTSOFT("glDeleteFramebuffersEXT");
|
2007-12-12 17:42:14 +00:00
|
|
|
|
|
|
|
// Vertex Buffer Objects
|
2012-11-10 06:09:51 +00:00
|
|
|
bglGenBuffersARB = (bglGenBuffersARBProcPtr) GETPROCEXTSOFT("glGenBuffersARB");
|
|
|
|
bglBindBufferARB = (bglBindBufferARBProcPtr) GETPROCEXTSOFT("glBindBufferARB");
|
|
|
|
bglDeleteBuffersARB = (bglDeleteBuffersARBProcPtr) GETPROCEXTSOFT("glDeleteBuffersARB");
|
|
|
|
bglBufferDataARB = (bglBufferDataARBProcPtr) GETPROCEXTSOFT("glBufferDataARB");
|
|
|
|
bglBufferSubDataARB = (bglBufferSubDataARBProcPtr) GETPROCEXTSOFT("glBufferSubDataARB");
|
|
|
|
bglMapBufferARB = (bglMapBufferARBProcPtr) GETPROCEXTSOFT("glMapBufferARB");
|
|
|
|
bglUnmapBufferARB = (bglUnmapBufferARBProcPtr) GETPROCEXTSOFT("glUnmapBufferARB");
|
2007-12-12 17:42:14 +00:00
|
|
|
|
2015-07-15 08:23:00 +00:00
|
|
|
// ARB_buffer_storage
|
|
|
|
bglBufferStorage = (bglBufferStorageProcPtr)GETPROCEXTSOFT("glBufferStorage");
|
|
|
|
|
|
|
|
// ARB_map_buffer_range
|
|
|
|
bglMapBufferRange = (bglMapBufferRangeProcPtr)GETPROCEXTSOFT("glMapBufferRange");
|
|
|
|
|
2008-03-26 09:24:25 +00:00
|
|
|
// Occlusion queries
|
2012-11-10 06:09:51 +00:00
|
|
|
bglGenQueriesARB = (bglGenQueriesARBProcPtr) GETPROCEXTSOFT("glGenQueriesARB");
|
|
|
|
bglDeleteQueriesARB = (bglDeleteQueriesARBProcPtr) GETPROCEXTSOFT("glDeleteQueriesARB");
|
|
|
|
bglIsQueryARB = (bglIsQueryARBProcPtr) GETPROCEXTSOFT("glIsQueryARB");
|
|
|
|
bglBeginQueryARB = (bglBeginQueryARBProcPtr) GETPROCEXTSOFT("glBeginQueryARB");
|
|
|
|
bglEndQueryARB = (bglEndQueryARBProcPtr) GETPROCEXTSOFT("glEndQueryARB");
|
|
|
|
bglGetQueryivARB = (bglGetQueryivARBProcPtr) GETPROCEXTSOFT("glGetQueryivARB");
|
|
|
|
bglGetQueryObjectivARB = (bglGetQueryObjectivARBProcPtr) GETPROCEXTSOFT("glGetQueryObjectivARB");
|
|
|
|
bglGetQueryObjectuivARB = (bglGetQueryObjectuivARBProcPtr) GETPROCEXTSOFT("glGetQueryObjectuivARB");
|
2008-03-26 09:24:25 +00:00
|
|
|
|
2008-11-16 21:46:11 +00:00
|
|
|
// Shader Objects
|
2012-11-10 06:09:51 +00:00
|
|
|
bglDeleteObjectARB = (bglDeleteObjectARBProcPtr) GETPROCEXTSOFT("glDeleteObjectARB");
|
|
|
|
bglGetHandleARB = (bglGetHandleARBProcPtr) GETPROCEXTSOFT("glGetHandleARB");
|
|
|
|
bglDetachObjectARB = (bglDetachObjectARBProcPtr) GETPROCEXTSOFT("glDetachObjectARB");
|
|
|
|
bglCreateShaderObjectARB = (bglCreateShaderObjectARBProcPtr) GETPROCEXTSOFT("glCreateShaderObjectARB");
|
|
|
|
bglShaderSourceARB = (bglShaderSourceARBProcPtr) GETPROCEXTSOFT("glShaderSourceARB");
|
|
|
|
bglCompileShaderARB = (bglCompileShaderARBProcPtr) GETPROCEXTSOFT("glCompileShaderARB");
|
|
|
|
bglCreateProgramObjectARB = (bglCreateProgramObjectARBProcPtr) GETPROCEXTSOFT("glCreateProgramObjectARB");
|
|
|
|
bglAttachObjectARB = (bglAttachObjectARBProcPtr) GETPROCEXTSOFT("glAttachObjectARB");
|
|
|
|
bglLinkProgramARB = (bglLinkProgramARBProcPtr) GETPROCEXTSOFT("glLinkProgramARB");
|
|
|
|
bglUseProgramObjectARB = (bglUseProgramObjectARBProcPtr) GETPROCEXTSOFT("glUseProgramObjectARB");
|
|
|
|
bglValidateProgramARB = (bglValidateProgramARBProcPtr) GETPROCEXTSOFT("glValidateProgramARB");
|
|
|
|
bglUniform1fARB = (bglUniform1fARBProcPtr) GETPROCEXTSOFT("glUniform1fARB");
|
|
|
|
bglUniform2fARB = (bglUniform2fARBProcPtr) GETPROCEXTSOFT("glUniform2fARB");
|
|
|
|
bglUniform3fARB = (bglUniform3fARBProcPtr) GETPROCEXTSOFT("glUniform3fARB");
|
|
|
|
bglUniform4fARB = (bglUniform4fARBProcPtr) GETPROCEXTSOFT("glUniform4fARB");
|
|
|
|
bglUniform1iARB = (bglUniform1iARBProcPtr) GETPROCEXTSOFT("glUniform1iARB");
|
|
|
|
bglUniform2iARB = (bglUniform2iARBProcPtr) GETPROCEXTSOFT("glUniform2iARB");
|
|
|
|
bglUniform3iARB = (bglUniform3iARBProcPtr) GETPROCEXTSOFT("glUniform3iARB");
|
|
|
|
bglUniform4iARB = (bglUniform4iARBProcPtr) GETPROCEXTSOFT("glUniform4iARB");
|
|
|
|
bglUniform1fvARB = (bglUniform1fvARBProcPtr) GETPROCEXTSOFT("glUniform1fvARB");
|
|
|
|
bglUniform2fvARB = (bglUniform2fvARBProcPtr) GETPROCEXTSOFT("glUniform2fvARB");
|
|
|
|
bglUniform3fvARB = (bglUniform3fvARBProcPtr) GETPROCEXTSOFT("glUniform3fvARB");
|
|
|
|
bglUniform4fvARB = (bglUniform4fvARBProcPtr) GETPROCEXTSOFT("glUniform4fvARB");
|
|
|
|
bglUniform1ivARB = (bglUniform1ivARBProcPtr) GETPROCEXTSOFT("glUniform1ivARB");
|
|
|
|
bglUniform2ivARB = (bglUniform2ivARBProcPtr) GETPROCEXTSOFT("glUniform2ivARB");
|
|
|
|
bglUniform3ivARB = (bglUniform3ivARBProcPtr) GETPROCEXTSOFT("glUniform3ivARB");
|
|
|
|
bglUniform4ivARB = (bglUniform4ivARBProcPtr) GETPROCEXTSOFT("glUniform4ivARB");
|
|
|
|
bglUniformMatrix2fvARB = (bglUniformMatrix2fvARBProcPtr) GETPROCEXTSOFT("glUniformMatrix2fvARB");
|
|
|
|
bglUniformMatrix3fvARB = (bglUniformMatrix3fvARBProcPtr) GETPROCEXTSOFT("glUniformMatrix3fvARB");
|
|
|
|
bglUniformMatrix4fvARB = (bglUniformMatrix4fvARBProcPtr) GETPROCEXTSOFT("glUniformMatrix4fvARB");
|
|
|
|
bglGetObjectParameterfvARB = (bglGetObjectParameterfvARBProcPtr) GETPROCEXTSOFT("glGetObjectParameterfvARB");
|
|
|
|
bglGetObjectParameterivARB = (bglGetObjectParameterivARBProcPtr) GETPROCEXTSOFT("glGetObjectParameterivARB");
|
|
|
|
bglGetInfoLogARB = (bglGetInfoLogARBProcPtr) GETPROCEXTSOFT("glGetInfoLogARB");
|
|
|
|
bglGetAttachedObjectsARB = (bglGetAttachedObjectsARBProcPtr) GETPROCEXTSOFT("glGetAttachedObjectsARB");
|
|
|
|
bglGetUniformLocationARB = (bglGetUniformLocationARBProcPtr) GETPROCEXTSOFT("glGetUniformLocationARB");
|
|
|
|
bglGetActiveUniformARB = (bglGetActiveUniformARBProcPtr) GETPROCEXTSOFT("glGetActiveUniformARB");
|
|
|
|
bglGetUniformfvARB = (bglGetUniformfvARBProcPtr) GETPROCEXTSOFT("glGetUniformfvARB");
|
|
|
|
bglGetUniformivARB = (bglGetUniformivARBProcPtr) GETPROCEXTSOFT("glGetUniformivARB");
|
|
|
|
bglGetShaderSourceARB = (bglGetShaderSourceARBProcPtr) GETPROCEXTSOFT("glGetShaderSourceARB");
|
2008-11-16 21:46:11 +00:00
|
|
|
|
2008-11-16 22:56:55 +00:00
|
|
|
// Vertex Shaders
|
2012-11-10 06:09:51 +00:00
|
|
|
bglVertexAttrib1dARB = (bglVertexAttrib1dARBProcPtr) GETPROCEXTSOFT("glVertexAttrib1dARB");
|
|
|
|
bglVertexAttrib1dvARB = (bglVertexAttrib1dvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib1dvARB");
|
|
|
|
bglVertexAttrib1fARB = (bglVertexAttrib1fARBProcPtr) GETPROCEXTSOFT("glVertexAttrib1fARB");
|
|
|
|
bglVertexAttrib1fvARB = (bglVertexAttrib1fvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib1fvARB");
|
|
|
|
bglVertexAttrib1sARB = (bglVertexAttrib1sARBProcPtr) GETPROCEXTSOFT("glVertexAttrib1sARB");
|
|
|
|
bglVertexAttrib1svARB = (bglVertexAttrib1svARBProcPtr) GETPROCEXTSOFT("glVertexAttrib1svARB");
|
|
|
|
bglVertexAttrib2dARB = (bglVertexAttrib2dARBProcPtr) GETPROCEXTSOFT("glVertexAttrib2dARB");
|
|
|
|
bglVertexAttrib2dvARB = (bglVertexAttrib2dvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib2dvARB");
|
|
|
|
bglVertexAttrib2fARB = (bglVertexAttrib2fARBProcPtr) GETPROCEXTSOFT("glVertexAttrib2fARB");
|
|
|
|
bglVertexAttrib2fvARB = (bglVertexAttrib2fvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib2fvARB");
|
|
|
|
bglVertexAttrib2sARB = (bglVertexAttrib2sARBProcPtr) GETPROCEXTSOFT("glVertexAttrib2sARB");
|
|
|
|
bglVertexAttrib2svARB = (bglVertexAttrib2svARBProcPtr) GETPROCEXTSOFT("glVertexAttrib2svARB");
|
|
|
|
bglVertexAttrib3dARB = (bglVertexAttrib3dARBProcPtr) GETPROCEXTSOFT("glVertexAttrib3dARB");
|
|
|
|
bglVertexAttrib3dvARB = (bglVertexAttrib3dvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib3dvARB");
|
|
|
|
bglVertexAttrib3fARB = (bglVertexAttrib3fARBProcPtr) GETPROCEXTSOFT("glVertexAttrib3fARB");
|
|
|
|
bglVertexAttrib3fvARB = (bglVertexAttrib3fvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib3fvARB");
|
|
|
|
bglVertexAttrib3sARB = (bglVertexAttrib3sARBProcPtr) GETPROCEXTSOFT("glVertexAttrib3sARB");
|
|
|
|
bglVertexAttrib3svARB = (bglVertexAttrib3svARBProcPtr) GETPROCEXTSOFT("glVertexAttrib3svARB");
|
|
|
|
bglVertexAttrib4NbvARB = (bglVertexAttrib4NbvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4NbvARB");
|
|
|
|
bglVertexAttrib4NivARB = (bglVertexAttrib4NivARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4NivARB");
|
|
|
|
bglVertexAttrib4NsvARB = (bglVertexAttrib4NsvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4NsvARB");
|
|
|
|
bglVertexAttrib4NubARB = (bglVertexAttrib4NubARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4NubARB");
|
|
|
|
bglVertexAttrib4NubvARB = (bglVertexAttrib4NubvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4NubvARB");
|
|
|
|
bglVertexAttrib4NuivARB = (bglVertexAttrib4NuivARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4NuivARB");
|
|
|
|
bglVertexAttrib4NusvARB = (bglVertexAttrib4NusvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4NusvARB");
|
|
|
|
bglVertexAttrib4bvARB = (bglVertexAttrib4bvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4bvARB");
|
|
|
|
bglVertexAttrib4dARB = (bglVertexAttrib4dARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4dARB");
|
|
|
|
bglVertexAttrib4dvARB = (bglVertexAttrib4dvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4dvARB");
|
|
|
|
bglVertexAttrib4fARB = (bglVertexAttrib4fARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4fARB");
|
|
|
|
bglVertexAttrib4fvARB = (bglVertexAttrib4fvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4fvARB");
|
|
|
|
bglVertexAttrib4ivARB = (bglVertexAttrib4ivARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4ivARB");
|
|
|
|
bglVertexAttrib4sARB = (bglVertexAttrib4sARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4sARB");
|
|
|
|
bglVertexAttrib4svARB = (bglVertexAttrib4svARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4svARB");
|
|
|
|
bglVertexAttrib4ubvARB = (bglVertexAttrib4ubvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4ubvARB");
|
|
|
|
bglVertexAttrib4uivARB = (bglVertexAttrib4uivARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4uivARB");
|
|
|
|
bglVertexAttrib4usvARB = (bglVertexAttrib4usvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4usvARB");
|
|
|
|
bglVertexAttribPointerARB = (bglVertexAttribPointerARBProcPtr) GETPROCEXTSOFT("glVertexAttribPointerARB");
|
|
|
|
bglEnableVertexAttribArrayARB = (bglEnableVertexAttribArrayARBProcPtr) GETPROCEXTSOFT("glEnableVertexAttribArrayARB");
|
|
|
|
bglDisableVertexAttribArrayARB = (bglDisableVertexAttribArrayARBProcPtr) GETPROCEXTSOFT("glDisableVertexAttribArrayARB");
|
|
|
|
bglGetVertexAttribdvARB = (bglGetVertexAttribdvARBProcPtr) GETPROCEXTSOFT("glGetVertexAttribdvARB");
|
|
|
|
bglGetVertexAttribfvARB = (bglGetVertexAttribfvARBProcPtr) GETPROCEXTSOFT("glGetVertexAttribfvARB");
|
|
|
|
bglGetVertexAttribivARB = (bglGetVertexAttribivARBProcPtr) GETPROCEXTSOFT("glGetVertexAttribivARB");
|
|
|
|
bglGetVertexAttribPointervARB = (bglGetVertexAttribPointervARBProcPtr) GETPROCEXTSOFT("glGetVertexAttribPointervARB");
|
|
|
|
bglBindAttribLocationARB = (bglBindAttribLocationARBProcPtr) GETPROCEXTSOFT("glBindAttribLocationARB");
|
|
|
|
bglGetActiveAttribARB = (bglGetActiveAttribARBProcPtr) GETPROCEXTSOFT("glGetActiveAttribARB");
|
|
|
|
bglGetAttribLocationARB = (bglGetAttribLocationARBProcPtr) GETPROCEXTSOFT("glGetAttribLocationARB");
|
2008-11-16 22:56:55 +00:00
|
|
|
|
2011-10-02 05:56:35 +00:00
|
|
|
// Debug Output
|
2011-10-11 16:52:53 +00:00
|
|
|
#ifndef __APPLE__
|
2012-11-10 06:09:51 +00:00
|
|
|
bglDebugMessageControlARB = (bglDebugMessageControlARBProcPtr) GETPROCEXTSOFT("glDebugMessageControlARB");
|
|
|
|
bglDebugMessageCallbackARB = (bglDebugMessageCallbackARBProcPtr) GETPROCEXTSOFT("glDebugMessageCallbackARB");
|
2011-10-11 16:52:53 +00:00
|
|
|
#endif
|
2011-10-02 05:56:35 +00:00
|
|
|
|
2012-11-24 09:13:29 +00:00
|
|
|
#ifdef _WIN32
|
2012-11-10 06:09:51 +00:00
|
|
|
bwglSwapIntervalEXT = (bwglSwapIntervalEXTProcPtr) GETPROCEXTSOFT("wglSwapIntervalEXT");
|
|
|
|
bwglCreateContextAttribsARB = (bwglCreateContextAttribsARBProcPtr) GETPROCEXTSOFT("wglCreateContextAttribsARB");
|
2008-07-22 21:03:09 +00:00
|
|
|
#endif
|
2015-05-16 09:12:12 +00:00
|
|
|
|
2016-01-08 01:33:20 +00:00
|
|
|
// the following ARB functions are used in POLYMER=0 builds:
|
|
|
|
// glActiveTextureARB,
|
2015-05-16 09:12:12 +00:00
|
|
|
// glDeleteBuffersARB, glGenBuffersARB, glBindBufferARB,
|
|
|
|
// glMapBufferARB, glUnmapBufferARB, glBufferDataARB,
|
|
|
|
// glClientActiveTextureARB,
|
|
|
|
// glGetCompressedTexImageARB, glCompressedTexImage2DARB
|
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
return err;
|
2015-05-16 09:12:12 +00:00
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t unloadgldriver(void)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2007-01-20 03:10:32 +00:00
|
|
|
unloadglulibrary();
|
2007-12-12 17:42:14 +00:00
|
|
|
|
2015-05-16 09:12:12 +00:00
|
|
|
#if defined DYNAMIC_GL || defined DYNAMIC_GLEXT
|
2013-10-07 10:06:09 +00:00
|
|
|
#if !defined RENDERTYPESDL && defined _WIN32
|
2006-04-24 19:04:22 +00:00
|
|
|
if (!hGLDLL) return 0;
|
2006-04-23 06:44:19 +00:00
|
|
|
#endif
|
|
|
|
|
2015-09-23 17:55:31 +00:00
|
|
|
DO_FREE_AND_NULL(gldriver);
|
2006-04-24 19:04:22 +00:00
|
|
|
|
2013-10-07 10:06:09 +00:00
|
|
|
#if !defined RENDERTYPESDL && defined _WIN32
|
2006-04-24 19:04:22 +00:00
|
|
|
FreeLibrary(hGLDLL);
|
|
|
|
hGLDLL = NULL;
|
2006-04-23 06:44:19 +00:00
|
|
|
#endif
|
2015-05-16 09:12:12 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined DYNAMIC_GL
|
|
|
|
#ifdef _WIN32
|
|
|
|
bwglCreateContext = (bwglCreateContextProcPtr) NULL;
|
|
|
|
bwglDeleteContext = (bwglDeleteContextProcPtr) NULL;
|
|
|
|
bwglGetProcAddress = (bwglGetProcAddressProcPtr) NULL;
|
|
|
|
bwglMakeCurrent = (bwglMakeCurrentProcPtr) NULL;
|
|
|
|
|
|
|
|
bwglSwapBuffers = (bwglSwapBuffersProcPtr) NULL;
|
|
|
|
bwglChoosePixelFormat = (bwglChoosePixelFormatProcPtr) NULL;
|
|
|
|
bwglDescribePixelFormat = (bwglDescribePixelFormatProcPtr) NULL;
|
|
|
|
bwglGetPixelFormat = (bwglGetPixelFormatProcPtr) NULL;
|
|
|
|
bwglSetPixelFormat = (bwglSetPixelFormatProcPtr) NULL;
|
|
|
|
#endif
|
2006-04-24 19:04:22 +00:00
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
bglClearColor = (bglClearColorProcPtr) NULL;
|
|
|
|
bglClear = (bglClearProcPtr) NULL;
|
|
|
|
bglColorMask = (bglColorMaskProcPtr) NULL;
|
|
|
|
bglAlphaFunc = (bglAlphaFuncProcPtr) NULL;
|
|
|
|
bglBlendFunc = (bglBlendFuncProcPtr) NULL;
|
|
|
|
bglCullFace = (bglCullFaceProcPtr) NULL;
|
|
|
|
bglFrontFace = (bglFrontFaceProcPtr) NULL;
|
|
|
|
bglPolygonOffset = (bglPolygonOffsetProcPtr) NULL;
|
|
|
|
bglPolygonMode = (bglPolygonModeProcPtr) NULL;
|
|
|
|
bglEnable = (bglEnableProcPtr) NULL;
|
|
|
|
bglDisable = (bglDisableProcPtr) NULL;
|
|
|
|
bglGetDoublev = (bglGetDoublevProcPtr) NULL;
|
|
|
|
bglGetFloatv = (bglGetFloatvProcPtr) NULL;
|
|
|
|
bglGetIntegerv = (bglGetIntegervProcPtr) NULL;
|
|
|
|
bglPushAttrib = (bglPushAttribProcPtr) NULL;
|
|
|
|
bglPopAttrib = (bglPopAttribProcPtr) NULL;
|
|
|
|
bglGetError = (bglGetErrorProcPtr) NULL;
|
|
|
|
bglGetString = (bglGetStringProcPtr) NULL;
|
|
|
|
bglHint = (bglHintProcPtr) NULL;
|
|
|
|
bglDrawBuffer = (bglDrawBufferProcPtr) NULL;
|
|
|
|
bglReadBuffer = (bglReadBufferProcPtr) NULL;
|
|
|
|
bglScissor = (bglScissorProcPtr) NULL;
|
|
|
|
bglClipPlane = (bglClipPlaneProcPtr) NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Depth
|
2012-11-10 06:09:51 +00:00
|
|
|
bglDepthFunc = (bglDepthFuncProcPtr) NULL;
|
|
|
|
bglDepthMask = (bglDepthMaskProcPtr) NULL;
|
2015-02-11 05:23:04 +00:00
|
|
|
// bglDepthRange = (bglDepthRangeProcPtr) NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Matrix
|
2012-11-10 06:09:51 +00:00
|
|
|
bglMatrixMode = (bglMatrixModeProcPtr) NULL;
|
|
|
|
bglOrtho = (bglOrthoProcPtr) NULL;
|
|
|
|
bglFrustum = (bglFrustumProcPtr) NULL;
|
|
|
|
bglViewport = (bglViewportProcPtr) NULL;
|
|
|
|
bglPushMatrix = (bglPushMatrixProcPtr) NULL;
|
|
|
|
bglPopMatrix = (bglPopMatrixProcPtr) NULL;
|
|
|
|
bglLoadIdentity = (bglLoadIdentityProcPtr) NULL;
|
|
|
|
bglLoadMatrixf = (bglLoadMatrixfProcPtr) NULL;
|
|
|
|
bglLoadMatrixd = (bglLoadMatrixdProcPtr) NULL;
|
|
|
|
bglMultMatrixf = (bglMultMatrixfProcPtr) NULL;
|
|
|
|
bglMultMatrixd = (bglMultMatrixdProcPtr) NULL;
|
|
|
|
bglRotatef = (bglRotatefProcPtr) NULL;
|
|
|
|
bglScalef = (bglScalefProcPtr) NULL;
|
|
|
|
bglTranslatef = (bglTranslatefProcPtr) NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Drawing
|
2012-11-10 06:09:51 +00:00
|
|
|
bglBegin = (bglBeginProcPtr) NULL;
|
|
|
|
bglEnd = (bglEndProcPtr) NULL;
|
|
|
|
bglVertex2f = (bglVertex2fProcPtr) NULL;
|
|
|
|
bglVertex2i = (bglVertex2iProcPtr) NULL;
|
|
|
|
bglVertex3f = (bglVertex3fProcPtr) NULL;
|
|
|
|
bglVertex3d = (bglVertex3dProcPtr) NULL;
|
|
|
|
bglVertex3fv = (bglVertex3fvProcPtr) NULL;
|
2014-02-10 10:56:14 +00:00
|
|
|
bglVertex3dv = (bglVertex3dvProcPtr) NULL;
|
2014-10-25 03:25:35 +00:00
|
|
|
bglRecti = (bglRectiProcPtr) NULL;
|
2014-09-30 04:12:09 +00:00
|
|
|
bglColor3f = (bglColor3fProcPtr) NULL;
|
2012-11-10 06:09:51 +00:00
|
|
|
bglColor4f = (bglColor4fProcPtr) NULL;
|
|
|
|
bglColor4ub = (bglColor4ubProcPtr) NULL;
|
|
|
|
bglTexCoord2d = (bglTexCoord2dProcPtr) NULL;
|
|
|
|
bglTexCoord2f = (bglTexCoord2fProcPtr) NULL;
|
|
|
|
bglTexCoord2i = (bglTexCoord2iProcPtr) NULL;
|
|
|
|
bglNormal3f = (bglNormal3fProcPtr) NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Lighting
|
2012-11-10 06:09:51 +00:00
|
|
|
bglShadeModel = (bglShadeModelProcPtr) NULL;
|
|
|
|
bglLightfv = (bglLightfvProcPtr) NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Raster funcs
|
2012-11-10 06:09:51 +00:00
|
|
|
bglReadPixels = (bglReadPixelsProcPtr) NULL;
|
|
|
|
bglRasterPos4i = (bglRasterPos4iProcPtr) NULL;
|
|
|
|
bglDrawPixels = (bglDrawPixelsProcPtr) NULL;
|
|
|
|
bglPixelStorei = (bglPixelStoreiProcPtr) NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Texture mapping
|
2012-11-10 06:09:51 +00:00
|
|
|
bglTexEnvf = (bglTexEnvfProcPtr) NULL;
|
|
|
|
bglGenTextures = (bglGenTexturesProcPtr) NULL;
|
|
|
|
bglDeleteTextures = (bglDeleteTexturesProcPtr) NULL;
|
|
|
|
bglBindTexture = (bglBindTextureProcPtr) NULL;
|
|
|
|
bglTexImage2D = (bglTexImage2DProcPtr) NULL;
|
|
|
|
bglCopyTexImage2D = (bglCopyTexImage2DProcPtr) NULL;
|
2014-02-10 10:56:14 +00:00
|
|
|
bglCopyTexSubImage2D = (bglCopyTexSubImage2DProcPtr) NULL;
|
2012-11-10 06:09:51 +00:00
|
|
|
bglTexSubImage2D = (bglTexSubImage2DProcPtr) NULL;
|
|
|
|
bglTexParameterf = (bglTexParameterfProcPtr) NULL;
|
|
|
|
bglTexParameteri = (bglTexParameteriProcPtr) NULL;
|
|
|
|
bglGetTexParameteriv = (bglGetTexParameterivProcPtr) NULL;
|
|
|
|
bglGetTexLevelParameteriv = (bglGetTexLevelParameterivProcPtr) NULL;
|
2015-05-16 09:12:12 +00:00
|
|
|
bglTexGenfv = (bglTexGenfvProcPtr) NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Fog
|
2012-11-10 06:09:51 +00:00
|
|
|
bglFogf = (bglFogfProcPtr) NULL;
|
|
|
|
bglFogi = (bglFogiProcPtr) NULL;
|
|
|
|
bglFogfv = (bglFogfvProcPtr) NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
2006-09-27 02:23:27 +00:00
|
|
|
// Display Lists
|
2012-11-10 06:09:51 +00:00
|
|
|
bglNewList = (bglNewListProcPtr) NULL;
|
|
|
|
bglEndList = (bglEndListProcPtr) NULL;
|
|
|
|
bglCallList = (bglCallListProcPtr) NULL;
|
|
|
|
bglDeleteLists = (bglDeleteListsProcPtr) NULL;
|
2006-09-27 02:23:27 +00:00
|
|
|
|
|
|
|
// Vertex Arrays
|
2012-11-10 06:09:51 +00:00
|
|
|
bglEnableClientState = (bglEnableClientStateProcPtr) NULL;
|
|
|
|
bglDisableClientState = (bglDisableClientStateProcPtr) NULL;
|
|
|
|
bglVertexPointer = (bglVertexPointerProcPtr) NULL;
|
|
|
|
bglNormalPointer = (bglNormalPointerProcPtr) NULL;
|
|
|
|
bglTexCoordPointer = (bglTexCoordPointerProcPtr) NULL;
|
2015-05-16 09:12:12 +00:00
|
|
|
bglDrawArrays = (bglDrawArraysProcPtr) NULL;
|
2012-11-10 06:09:51 +00:00
|
|
|
bglDrawElements = (bglDrawElementsProcPtr) NULL;
|
2006-09-27 02:23:27 +00:00
|
|
|
|
2006-10-04 09:54:25 +00:00
|
|
|
// Stencil Buffer
|
2012-11-10 06:09:51 +00:00
|
|
|
bglClearStencil = (bglClearStencilProcPtr) NULL;
|
|
|
|
bglStencilOp = (bglStencilOpProcPtr) NULL;
|
|
|
|
bglStencilFunc = (bglStencilFuncProcPtr) NULL;
|
2015-05-16 09:12:12 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined DYNAMIC_GLEXT
|
|
|
|
bglBlendEquation = (bglBlendEquationProcPtr) NULL;
|
|
|
|
|
|
|
|
bglTexImage3D = (bglTexImage3DProcPtr) NULL;
|
|
|
|
bglCompressedTexImage2DARB = (bglCompressedTexImage2DARBProcPtr) NULL;
|
|
|
|
bglGetCompressedTexImageARB = (bglGetCompressedTexImageARBProcPtr) NULL;
|
2006-10-04 09:54:25 +00:00
|
|
|
|
2006-12-31 06:32:04 +00:00
|
|
|
// GPU Programs
|
2012-11-10 06:09:51 +00:00
|
|
|
bglGenProgramsARB = (bglGenProgramsARBProcPtr) NULL;
|
|
|
|
bglBindProgramARB = (bglBindProgramARBProcPtr) NULL;
|
|
|
|
bglProgramStringARB = (bglProgramStringARBProcPtr) NULL;
|
2014-02-10 10:56:14 +00:00
|
|
|
bglDeleteProgramsARB = (bglDeleteProgramsARBProcPtr) NULL;
|
2006-12-31 06:32:04 +00:00
|
|
|
|
|
|
|
// Multitexturing
|
2012-11-10 06:09:51 +00:00
|
|
|
bglActiveTextureARB = (bglActiveTextureARBProcPtr) NULL;
|
|
|
|
bglClientActiveTextureARB = (bglClientActiveTextureARBProcPtr) NULL;
|
|
|
|
bglMultiTexCoord2dARB = (bglMultiTexCoord2dARBProcPtr) NULL;
|
|
|
|
bglMultiTexCoord2fARB = (bglMultiTexCoord2fARBProcPtr) NULL;
|
2006-12-31 06:32:04 +00:00
|
|
|
|
2007-01-06 01:29:45 +00:00
|
|
|
// Frame Buffer Objects
|
2012-11-10 06:09:51 +00:00
|
|
|
bglGenFramebuffersEXT = (bglGenFramebuffersEXTProcPtr) NULL;
|
|
|
|
bglBindFramebufferEXT = (bglBindFramebufferEXTProcPtr) NULL;
|
|
|
|
bglFramebufferTexture2DEXT = (bglFramebufferTexture2DEXTProcPtr) NULL;
|
|
|
|
bglCheckFramebufferStatusEXT = (bglCheckFramebufferStatusEXTProcPtr) NULL;
|
|
|
|
bglDeleteFramebuffersEXT = (bglDeleteFramebuffersEXTProcPtr) NULL;
|
2007-12-12 17:42:14 +00:00
|
|
|
|
|
|
|
// Vertex Buffer Objects
|
2012-11-10 06:09:51 +00:00
|
|
|
bglGenBuffersARB = (bglGenBuffersARBProcPtr) NULL;
|
|
|
|
bglBindBufferARB = (bglBindBufferARBProcPtr) NULL;
|
|
|
|
bglDeleteBuffersARB = (bglDeleteBuffersARBProcPtr) NULL;
|
|
|
|
bglBufferDataARB = (bglBufferDataARBProcPtr) NULL;
|
|
|
|
bglBufferSubDataARB = (bglBufferSubDataARBProcPtr) NULL;
|
|
|
|
bglMapBufferARB = (bglMapBufferARBProcPtr) NULL;
|
|
|
|
bglUnmapBufferARB = (bglUnmapBufferARBProcPtr) NULL;
|
2007-01-06 01:29:45 +00:00
|
|
|
|
2015-07-15 08:23:00 +00:00
|
|
|
// ARB_buffer_storage
|
|
|
|
bglBufferStorage = (bglBufferStorageProcPtr) NULL;
|
|
|
|
|
|
|
|
// ARB_map_buffer_range
|
|
|
|
bglMapBufferRange = (bglMapBufferRangeProcPtr)NULL;
|
|
|
|
|
2008-11-16 21:46:11 +00:00
|
|
|
// Occlusion queries
|
2012-11-10 06:09:51 +00:00
|
|
|
bglGenQueriesARB = (bglGenQueriesARBProcPtr) NULL;
|
|
|
|
bglDeleteQueriesARB = (bglDeleteQueriesARBProcPtr) NULL;
|
|
|
|
bglIsQueryARB = (bglIsQueryARBProcPtr) NULL;
|
|
|
|
bglBeginQueryARB = (bglBeginQueryARBProcPtr) NULL;
|
|
|
|
bglEndQueryARB = (bglEndQueryARBProcPtr) NULL;
|
|
|
|
bglGetQueryivARB = (bglGetQueryivARBProcPtr) NULL;
|
|
|
|
bglGetQueryObjectivARB = (bglGetQueryObjectivARBProcPtr) NULL;
|
|
|
|
bglGetQueryObjectuivARB = (bglGetQueryObjectuivARBProcPtr) NULL;
|
2008-11-16 21:46:11 +00:00
|
|
|
|
|
|
|
// Shader Objects
|
2012-11-10 06:09:51 +00:00
|
|
|
bglDeleteObjectARB = (bglDeleteObjectARBProcPtr) NULL;
|
|
|
|
bglGetHandleARB = (bglGetHandleARBProcPtr) NULL;
|
|
|
|
bglDetachObjectARB = (bglDetachObjectARBProcPtr) NULL;
|
|
|
|
bglCreateShaderObjectARB = (bglCreateShaderObjectARBProcPtr) NULL;
|
|
|
|
bglShaderSourceARB = (bglShaderSourceARBProcPtr) NULL;
|
|
|
|
bglCompileShaderARB = (bglCompileShaderARBProcPtr) NULL;
|
|
|
|
bglCreateProgramObjectARB = (bglCreateProgramObjectARBProcPtr) NULL;
|
|
|
|
bglAttachObjectARB = (bglAttachObjectARBProcPtr) NULL;
|
|
|
|
bglLinkProgramARB = (bglLinkProgramARBProcPtr) NULL;
|
|
|
|
bglUseProgramObjectARB = (bglUseProgramObjectARBProcPtr) NULL;
|
|
|
|
bglValidateProgramARB = (bglValidateProgramARBProcPtr) NULL;
|
|
|
|
bglUniform1fARB = (bglUniform1fARBProcPtr) NULL;
|
|
|
|
bglUniform2fARB = (bglUniform2fARBProcPtr) NULL;
|
|
|
|
bglUniform3fARB = (bglUniform3fARBProcPtr) NULL;
|
|
|
|
bglUniform4fARB = (bglUniform4fARBProcPtr) NULL;
|
|
|
|
bglUniform1iARB = (bglUniform1iARBProcPtr) NULL;
|
|
|
|
bglUniform2iARB = (bglUniform2iARBProcPtr) NULL;
|
|
|
|
bglUniform3iARB = (bglUniform3iARBProcPtr) NULL;
|
|
|
|
bglUniform4iARB = (bglUniform4iARBProcPtr) NULL;
|
|
|
|
bglUniform1fvARB = (bglUniform1fvARBProcPtr) NULL;
|
|
|
|
bglUniform2fvARB = (bglUniform2fvARBProcPtr) NULL;
|
|
|
|
bglUniform3fvARB = (bglUniform3fvARBProcPtr) NULL;
|
|
|
|
bglUniform4fvARB = (bglUniform4fvARBProcPtr) NULL;
|
|
|
|
bglUniform1ivARB = (bglUniform1ivARBProcPtr) NULL;
|
|
|
|
bglUniform2ivARB = (bglUniform2ivARBProcPtr) NULL;
|
|
|
|
bglUniform3ivARB = (bglUniform3ivARBProcPtr) NULL;
|
|
|
|
bglUniform4ivARB = (bglUniform4ivARBProcPtr) NULL;
|
|
|
|
bglUniformMatrix2fvARB = (bglUniformMatrix2fvARBProcPtr) NULL;
|
|
|
|
bglUniformMatrix3fvARB = (bglUniformMatrix3fvARBProcPtr) NULL;
|
|
|
|
bglUniformMatrix4fvARB = (bglUniformMatrix4fvARBProcPtr) NULL;
|
|
|
|
bglGetObjectParameterfvARB = (bglGetObjectParameterfvARBProcPtr) NULL;
|
|
|
|
bglGetObjectParameterivARB = (bglGetObjectParameterivARBProcPtr) NULL;
|
|
|
|
bglGetInfoLogARB = (bglGetInfoLogARBProcPtr) NULL;
|
|
|
|
bglGetAttachedObjectsARB = (bglGetAttachedObjectsARBProcPtr) NULL;
|
|
|
|
bglGetUniformLocationARB = (bglGetUniformLocationARBProcPtr) NULL;
|
|
|
|
bglGetActiveUniformARB = (bglGetActiveUniformARBProcPtr) NULL;
|
|
|
|
bglGetUniformfvARB = (bglGetUniformfvARBProcPtr) NULL;
|
|
|
|
bglGetUniformivARB = (bglGetUniformivARBProcPtr) NULL;
|
|
|
|
bglGetShaderSourceARB = (bglGetShaderSourceARBProcPtr) NULL;
|
2008-11-16 21:46:11 +00:00
|
|
|
|
2008-11-16 22:56:55 +00:00
|
|
|
// Vertex Shaders
|
2012-11-10 06:09:51 +00:00
|
|
|
bglVertexAttrib1dARB = (bglVertexAttrib1dARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib1dvARB = (bglVertexAttrib1dvARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib1fARB = (bglVertexAttrib1fARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib1fvARB = (bglVertexAttrib1fvARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib1sARB = (bglVertexAttrib1sARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib1svARB = (bglVertexAttrib1svARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib2dARB = (bglVertexAttrib2dARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib2dvARB = (bglVertexAttrib2dvARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib2fARB = (bglVertexAttrib2fARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib2fvARB = (bglVertexAttrib2fvARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib2sARB = (bglVertexAttrib2sARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib2svARB = (bglVertexAttrib2svARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib3dARB = (bglVertexAttrib3dARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib3dvARB = (bglVertexAttrib3dvARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib3fARB = (bglVertexAttrib3fARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib3fvARB = (bglVertexAttrib3fvARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib3sARB = (bglVertexAttrib3sARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib3svARB = (bglVertexAttrib3svARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4NbvARB = (bglVertexAttrib4NbvARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4NivARB = (bglVertexAttrib4NivARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4NsvARB = (bglVertexAttrib4NsvARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4NubARB = (bglVertexAttrib4NubARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4NubvARB = (bglVertexAttrib4NubvARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4NuivARB = (bglVertexAttrib4NuivARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4NusvARB = (bglVertexAttrib4NusvARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4bvARB = (bglVertexAttrib4bvARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4dARB = (bglVertexAttrib4dARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4dvARB = (bglVertexAttrib4dvARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4fARB = (bglVertexAttrib4fARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4fvARB = (bglVertexAttrib4fvARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4ivARB = (bglVertexAttrib4ivARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4sARB = (bglVertexAttrib4sARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4svARB = (bglVertexAttrib4svARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4ubvARB = (bglVertexAttrib4ubvARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4uivARB = (bglVertexAttrib4uivARBProcPtr) NULL;
|
|
|
|
bglVertexAttrib4usvARB = (bglVertexAttrib4usvARBProcPtr) NULL;
|
|
|
|
bglVertexAttribPointerARB = (bglVertexAttribPointerARBProcPtr) NULL;
|
|
|
|
bglEnableVertexAttribArrayARB = (bglEnableVertexAttribArrayARBProcPtr) NULL;
|
|
|
|
bglDisableVertexAttribArrayARB = (bglDisableVertexAttribArrayARBProcPtr) NULL;
|
|
|
|
bglGetVertexAttribdvARB = (bglGetVertexAttribdvARBProcPtr) NULL;
|
|
|
|
bglGetVertexAttribfvARB = (bglGetVertexAttribfvARBProcPtr) NULL;
|
|
|
|
bglGetVertexAttribivARB = (bglGetVertexAttribivARBProcPtr) NULL;
|
|
|
|
bglGetVertexAttribPointervARB = (bglGetVertexAttribPointervARBProcPtr) NULL;
|
|
|
|
bglBindAttribLocationARB = (bglBindAttribLocationARBProcPtr) NULL;
|
|
|
|
bglGetActiveAttribARB = (bglGetActiveAttribARBProcPtr) NULL;
|
|
|
|
bglGetAttribLocationARB = (bglGetAttribLocationARBProcPtr) NULL;
|
2008-11-16 22:56:55 +00:00
|
|
|
|
2015-05-16 09:12:12 +00:00
|
|
|
// Debug Output
|
|
|
|
#ifndef __APPLE__
|
|
|
|
bglDebugMessageControlARB = (bglDebugMessageControlARBProcPtr) NULL;
|
|
|
|
bglDebugMessageCallbackARB = (bglDebugMessageCallbackARBProcPtr) NULL;
|
|
|
|
#endif
|
2012-11-10 06:09:51 +00:00
|
|
|
|
2015-05-16 09:12:12 +00:00
|
|
|
#ifdef _WIN32
|
2012-11-10 06:09:51 +00:00
|
|
|
bwglSwapIntervalEXT = (bwglSwapIntervalEXTProcPtr) NULL;
|
2015-05-16 09:12:12 +00:00
|
|
|
bwglCreateContextAttribsARB = (bwglCreateContextAttribsARBProcPtr) NULL;
|
|
|
|
#endif
|
2006-04-23 06:44:19 +00:00
|
|
|
#endif
|
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
return 0;
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
2015-05-16 09:12:12 +00:00
|
|
|
#if defined DYNAMIC_GLU
|
|
|
|
#if defined _WIN32
|
|
|
|
static HMODULE hGLUDLL;
|
|
|
|
#else
|
|
|
|
static void *gluhandle = NULL;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
char *glulibrary = NULL;
|
|
|
|
|
2011-01-16 02:50:27 +00:00
|
|
|
static void *glugetproc_(const char *s, int32_t *err, int32_t fatal)
|
2007-01-16 03:19:04 +00:00
|
|
|
{
|
|
|
|
void *t;
|
|
|
|
#if defined _WIN32
|
2011-01-16 02:50:27 +00:00
|
|
|
t = (void *)GetProcAddress(hGLUDLL,s);
|
2007-01-16 03:19:04 +00:00
|
|
|
#else
|
2011-01-16 02:50:27 +00:00
|
|
|
t = (void *)dlsym(gluhandle,s);
|
2007-01-16 03:19:04 +00:00
|
|
|
#endif
|
2007-12-12 17:42:14 +00:00
|
|
|
if (!t && fatal)
|
|
|
|
{
|
2007-01-16 03:19:04 +00:00
|
|
|
initprintf("Failed to find %s in %s\n", s, glulibrary);
|
|
|
|
*err = 1;
|
|
|
|
}
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
#define GLUGETPROC(s) glugetproc_(s,&err,1)
|
|
|
|
#define GLUGETPROCSOFT(s) glugetproc_(s,&err,0)
|
2015-05-16 09:12:12 +00:00
|
|
|
#endif
|
2007-01-16 03:19:04 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t loadglulibrary(const char *driver)
|
2007-01-16 03:19:04 +00:00
|
|
|
{
|
2015-05-16 09:12:12 +00:00
|
|
|
#if defined DYNAMIC_GLU
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t err=0;
|
2007-01-16 03:19:04 +00:00
|
|
|
|
2013-10-07 10:06:09 +00:00
|
|
|
#if defined _WIN32
|
2007-01-16 03:19:04 +00:00
|
|
|
if (hGLUDLL) return 0;
|
|
|
|
#endif
|
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
if (!driver)
|
|
|
|
{
|
2007-01-16 03:19:04 +00:00
|
|
|
#ifdef _WIN32
|
2008-08-22 23:10:54 +00:00
|
|
|
driver = "glu32.dll";
|
2007-01-16 03:19:04 +00:00
|
|
|
#elif defined __APPLE__
|
|
|
|
driver = "/System/Library/Frameworks/OpenGL.framework/OpenGL"; // FIXME: like I know anything about Apple. Hah.
|
2014-07-22 11:18:59 +00:00
|
|
|
#elif defined __OpenBSD__
|
|
|
|
driver = "libGLU.so";
|
2007-01-16 03:19:04 +00:00
|
|
|
#else
|
2008-06-11 02:33:23 +00:00
|
|
|
driver = "libGLU.so.1";
|
2007-01-16 03:19:04 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined _WIN32
|
|
|
|
hGLUDLL = LoadLibrary(driver);
|
2015-05-16 09:12:12 +00:00
|
|
|
if (!hGLUDLL)
|
2007-01-16 03:19:04 +00:00
|
|
|
#else
|
|
|
|
gluhandle = dlopen(driver, RTLD_NOW|RTLD_GLOBAL);
|
2015-05-16 09:12:12 +00:00
|
|
|
if (!gluhandle)
|
2007-01-16 03:19:04 +00:00
|
|
|
#endif
|
2015-05-16 09:12:12 +00:00
|
|
|
{
|
|
|
|
initprintf("Failed loading \"%s\"\n",driver);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-10-07 06:47:35 +00:00
|
|
|
glulibrary = Bstrdup(driver);
|
2007-01-16 03:19:04 +00:00
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
bgluTessBeginContour = (bgluTessBeginContourProcPtr) GLUGETPROC("gluTessBeginContour");
|
|
|
|
bgluTessBeginPolygon = (bgluTessBeginPolygonProcPtr) GLUGETPROC("gluTessBeginPolygon");
|
|
|
|
bgluTessCallback = (bgluTessCallbackProcPtr) GLUGETPROC("gluTessCallback");
|
|
|
|
bgluTessEndContour = (bgluTessEndContourProcPtr) GLUGETPROC("gluTessEndContour");
|
|
|
|
bgluTessEndPolygon = (bgluTessEndPolygonProcPtr) GLUGETPROC("gluTessEndPolygon");
|
|
|
|
bgluTessNormal = (bgluTessNormalProcPtr) GLUGETPROC("gluTessNormal");
|
|
|
|
bgluTessProperty = (bgluTessPropertyProcPtr) GLUGETPROC("gluTessProperty");
|
|
|
|
bgluTessVertex = (bgluTessVertexProcPtr) GLUGETPROC("gluTessVertex");
|
|
|
|
bgluNewTess = (bgluNewTessProcPtr) GLUGETPROC("gluNewTess");
|
|
|
|
bgluDeleteTess = (bgluDeleteTessProcPtr) GLUGETPROC("gluDeleteTess");
|
2007-07-01 06:32:03 +00:00
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
bgluPerspective = (bgluPerspectiveProcPtr) GLUGETPROC("gluPerspective");
|
2007-07-01 06:32:03 +00:00
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
bgluErrorString = (bgluErrorStringProcPtr) GLUGETPROC("gluErrorString");
|
2007-01-16 03:19:04 +00:00
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
bgluProject = (bgluProjectProcPtr) GLUGETPROC("gluProject");
|
|
|
|
bgluUnProject = (bgluUnProjectProcPtr) GLUGETPROC("gluUnProject");
|
2007-07-01 06:32:03 +00:00
|
|
|
|
2007-01-16 03:19:04 +00:00
|
|
|
if (err) unloadglulibrary();
|
|
|
|
return err;
|
2015-05-16 09:12:12 +00:00
|
|
|
#else
|
|
|
|
UNREFERENCED_PARAMETER(driver);
|
|
|
|
return 0;
|
|
|
|
#endif
|
2007-01-16 03:19:04 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t unloadglulibrary(void)
|
2007-01-16 03:19:04 +00:00
|
|
|
{
|
2015-05-16 09:12:12 +00:00
|
|
|
#if defined DYNAMIC_GLU
|
2013-10-07 10:06:09 +00:00
|
|
|
#if defined _WIN32
|
2007-01-16 03:19:04 +00:00
|
|
|
if (!hGLUDLL) return 0;
|
|
|
|
#endif
|
|
|
|
|
2015-09-23 17:55:31 +00:00
|
|
|
DO_FREE_AND_NULL(glulibrary);
|
2007-01-16 03:19:04 +00:00
|
|
|
|
2013-10-07 10:06:09 +00:00
|
|
|
#if defined _WIN32
|
2007-01-16 03:19:04 +00:00
|
|
|
FreeLibrary(hGLUDLL);
|
|
|
|
hGLUDLL = NULL;
|
|
|
|
#else
|
|
|
|
if (gluhandle) dlclose(gluhandle);
|
|
|
|
gluhandle = NULL;
|
|
|
|
#endif
|
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
bgluTessBeginContour = (bgluTessBeginContourProcPtr) NULL;
|
|
|
|
bgluTessBeginPolygon = (bgluTessBeginPolygonProcPtr) NULL;
|
|
|
|
bgluTessCallback = (bgluTessCallbackProcPtr) NULL;
|
|
|
|
bgluTessEndContour = (bgluTessEndContourProcPtr) NULL;
|
|
|
|
bgluTessEndPolygon = (bgluTessEndPolygonProcPtr) NULL;
|
|
|
|
bgluTessNormal = (bgluTessNormalProcPtr) NULL;
|
|
|
|
bgluTessProperty = (bgluTessPropertyProcPtr) NULL;
|
|
|
|
bgluTessVertex = (bgluTessVertexProcPtr) NULL;
|
|
|
|
bgluNewTess = (bgluNewTessProcPtr) NULL;
|
|
|
|
bgluDeleteTess = (bgluDeleteTessProcPtr) NULL;
|
2007-07-01 06:32:03 +00:00
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
bgluPerspective = (bgluPerspectiveProcPtr) NULL;
|
2007-07-01 06:32:03 +00:00
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
bgluErrorString = (bgluErrorStringProcPtr) NULL;
|
2007-07-01 06:32:03 +00:00
|
|
|
|
2012-11-10 06:09:51 +00:00
|
|
|
bgluProject = (bgluProjectProcPtr) NULL;
|
|
|
|
bgluUnProject = (bgluUnProjectProcPtr) NULL;
|
2015-05-16 09:12:12 +00:00
|
|
|
#endif
|
2007-12-12 17:42:14 +00:00
|
|
|
|
2007-01-16 03:19:04 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2011-07-24 15:15:57 +00:00
|
|
|
|
|
|
|
//////// glGenTextures/glDeleteTextures debugging ////////
|
|
|
|
# if defined DEBUGGINGAIDS && defined DEBUG_TEXTURE_NAMES
|
|
|
|
static uint8_t *texnameused; // bitmap
|
|
|
|
static uint32_t *texnamefromwhere; // hash of __FILE__
|
|
|
|
static uint32_t texnameallocsize;
|
|
|
|
|
|
|
|
// djb3 algorithm
|
|
|
|
static inline uint32_t texdbg_getcode(const char *s)
|
|
|
|
{
|
|
|
|
uint32_t h = 5381;
|
|
|
|
int32_t ch;
|
|
|
|
|
|
|
|
while ((ch = *s++) != '\0')
|
|
|
|
h = ((h << 5) + h) ^ ch;
|
|
|
|
|
|
|
|
return h;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void texdbg_realloc(uint32_t maxtexname)
|
|
|
|
{
|
|
|
|
uint32_t newsize = texnameallocsize ? texnameallocsize : 64;
|
|
|
|
|
2012-04-29 20:54:37 +00:00
|
|
|
if (maxtexname < texnameallocsize)
|
2011-07-24 15:15:57 +00:00
|
|
|
return;
|
|
|
|
|
2012-04-29 20:54:37 +00:00
|
|
|
while (maxtexname >= newsize)
|
2011-07-24 15:15:57 +00:00
|
|
|
newsize <<= 1;
|
|
|
|
// initprintf("texdebug: new size %u\n", newsize);
|
|
|
|
|
2014-05-30 00:02:19 +00:00
|
|
|
texnameused = Xrealloc(texnameused, newsize>>3);
|
|
|
|
texnamefromwhere = Xrealloc(texnamefromwhere, newsize*sizeof(uint32_t));
|
2011-07-24 15:15:57 +00:00
|
|
|
|
|
|
|
Bmemset(texnameused + (texnameallocsize>>3), 0, (newsize-texnameallocsize)>>3);
|
|
|
|
Bmemset(texnamefromwhere + texnameallocsize, 0, (newsize-texnameallocsize)*sizeof(uint32_t));
|
|
|
|
|
|
|
|
texnameallocsize = newsize;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef bglGenTextures
|
|
|
|
void texdbg_bglGenTextures(GLsizei n, GLuint *textures, const char *srcfn)
|
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
uint32_t hash = srcfn ? texdbg_getcode(srcfn) : 0;
|
|
|
|
|
|
|
|
for (i=0; i<n; i++)
|
|
|
|
if (textures[i] < texnameallocsize && (texnameused[textures[i]>>3]&(1<<(textures[i]&7))))
|
|
|
|
initprintf("texdebug %x Gen: overwriting used tex name %u from %x\n", hash, textures[i], texnamefromwhere[textures[i]]);
|
|
|
|
|
|
|
|
bglGenTextures(n, textures);
|
|
|
|
|
|
|
|
{
|
|
|
|
GLuint maxtexname = 0;
|
|
|
|
|
|
|
|
for (i=0; i<n; i++)
|
|
|
|
maxtexname = max(maxtexname, textures[i]);
|
|
|
|
|
|
|
|
texdbg_realloc(maxtexname);
|
|
|
|
|
|
|
|
for (i=0; i<n; i++)
|
|
|
|
{
|
|
|
|
texnameused[textures[i]>>3] |= (1<<(textures[i]&7));
|
|
|
|
texnamefromwhere[textures[i]] = hash;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef bglDeleteTextures
|
|
|
|
void texdbg_bglDeleteTextures(GLsizei n, const GLuint *textures, const char *srcfn)
|
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
uint32_t hash = srcfn ? texdbg_getcode(srcfn) : 0;
|
|
|
|
|
|
|
|
for (i=0; i<n; i++)
|
|
|
|
if (textures[i] < texnameallocsize)
|
|
|
|
{
|
|
|
|
if ((texnameused[textures[i]>>3]&(1<<(textures[i]&7)))==0)
|
|
|
|
initprintf("texdebug %x Del: deleting unused tex name %u\n", hash, textures[i]);
|
|
|
|
else if ((texnameused[textures[i]>>3]&(1<<(textures[i]&7))) &&
|
|
|
|
texnamefromwhere[textures[i]] != hash)
|
|
|
|
initprintf("texdebug %x Del: deleting foreign tex name %u from %x\n", hash,
|
|
|
|
textures[i], texnamefromwhere[textures[i]]);
|
|
|
|
}
|
|
|
|
|
|
|
|
bglDeleteTextures(n, textures);
|
|
|
|
|
|
|
|
if (texnameallocsize)
|
|
|
|
for (i=0; i<n; i++)
|
|
|
|
{
|
|
|
|
texnameused[textures[i]>>3] &= ~(1<<(textures[i]&7));
|
|
|
|
texnamefromwhere[textures[i]] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# endif // defined DEBUGGINGAIDS
|
|
|
|
|
|
|
|
#endif
|