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"
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2006-05-12 21:55:05 +00:00
|
|
|
#if defined USE_OPENGL
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
#ifdef RENDERTYPESDL
|
2008-04-25 01:46:19 +00:00
|
|
|
#include "sdl_inc.h"
|
2006-04-23 06:44:19 +00:00
|
|
|
#endif
|
|
|
|
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
|
|
|
void (APIENTRY *bglClear)(GLbitfield mask);
|
|
|
|
void (APIENTRY *bglColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
|
|
|
void (APIENTRY *bglAlphaFunc)(GLenum func, GLclampf ref);
|
|
|
|
void (APIENTRY *bglBlendFunc)(GLenum sfactor, GLenum dfactor);
|
2012-10-21 04:52:43 +00:00
|
|
|
void (APIENTRY *bglBlendEquation)(GLenum mode);
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglCullFace)(GLenum mode);
|
|
|
|
void (APIENTRY *bglFrontFace)(GLenum mode);
|
|
|
|
void (APIENTRY *bglPolygonOffset)(GLfloat factor, GLfloat units);
|
|
|
|
void (APIENTRY *bglPolygonMode)(GLenum face, GLenum mode);
|
|
|
|
void (APIENTRY *bglEnable)(GLenum cap);
|
|
|
|
void (APIENTRY *bglDisable)(GLenum cap);
|
|
|
|
void (APIENTRY *bglGetDoublev)(GLenum pname, GLdouble *params);
|
|
|
|
void (APIENTRY *bglGetFloatv)(GLenum pname, GLfloat *params);
|
|
|
|
void (APIENTRY *bglGetIntegerv)(GLenum pname, GLint *params);
|
|
|
|
void (APIENTRY *bglPushAttrib)(GLbitfield mask);
|
|
|
|
void (APIENTRY *bglPopAttrib)(void);
|
|
|
|
GLenum(APIENTRY *bglGetError)(void);
|
|
|
|
const GLubyte *(APIENTRY *bglGetString)(GLenum name);
|
|
|
|
void (APIENTRY *bglHint)(GLenum target, GLenum mode);
|
|
|
|
void (APIENTRY *bglDrawBuffer)(GLenum mode);
|
|
|
|
void (APIENTRY *bglReadBuffer)(GLenum mode);
|
|
|
|
void (APIENTRY *bglScissor)(GLint x, GLint y, GLsizei width, GLsizei height);
|
|
|
|
void (APIENTRY *bglClipPlane)(GLenum plane, const GLdouble *equation);
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
// Depth
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglDepthFunc)(GLenum func);
|
|
|
|
void (APIENTRY *bglDepthMask)(GLboolean flag);
|
|
|
|
void (APIENTRY *bglDepthRange)(GLclampd near_val, GLclampd far_val);
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
// Matrix
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglMatrixMode)(GLenum mode);
|
|
|
|
void (APIENTRY *bglOrtho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val);
|
|
|
|
void (APIENTRY *bglFrustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val);
|
|
|
|
void (APIENTRY *bglViewport)(GLint x, GLint y, GLsizei width, GLsizei height);
|
|
|
|
void (APIENTRY *bglPushMatrix)(void);
|
|
|
|
void (APIENTRY *bglPopMatrix)(void);
|
|
|
|
void (APIENTRY *bglLoadIdentity)(void);
|
|
|
|
void (APIENTRY *bglLoadMatrixf)(const GLfloat *m);
|
|
|
|
void (APIENTRY *bglLoadMatrixd)(const GLdouble *m);
|
|
|
|
void (APIENTRY *bglMultMatrixf)(const GLfloat *m);
|
|
|
|
void (APIENTRY *bglMultMatrixd)(const GLdouble *m);
|
|
|
|
void (APIENTRY *bglRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
|
|
|
|
void (APIENTRY *bglScalef)(GLfloat x, GLfloat y, GLfloat z);
|
|
|
|
void (APIENTRY *bglTranslatef)(GLfloat x, GLfloat y, GLfloat z);
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
// Drawing
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglBegin)(GLenum mode);
|
|
|
|
void (APIENTRY *bglEnd)(void);
|
|
|
|
void (APIENTRY *bglVertex2f)(GLfloat x, GLfloat y);
|
|
|
|
void (APIENTRY *bglVertex2i)(GLint x, GLint y);
|
|
|
|
void (APIENTRY *bglVertex3f)(GLfloat x, GLfloat y, GLfloat z);
|
|
|
|
void (APIENTRY *bglVertex3d)(GLdouble x, GLdouble y, GLdouble z);
|
|
|
|
void (APIENTRY *bglVertex3fv)(const GLfloat *v);
|
|
|
|
void (APIENTRY *bglVertex3dv)(const GLdouble *v);
|
|
|
|
void (APIENTRY *bglColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
|
|
|
void (APIENTRY *bglColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
|
|
|
|
void (APIENTRY *bglTexCoord2d)(GLdouble s, GLdouble t);
|
|
|
|
void (APIENTRY *bglTexCoord2f)(GLfloat s, GLfloat t);
|
|
|
|
void (APIENTRY *bglTexCoord2i)(GLint s, GLint t);
|
|
|
|
void (APIENTRY *bglNormal3f)(GLfloat x, GLfloat y, GLfloat z);
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
// Lighting
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglShadeModel)(GLenum mode);
|
|
|
|
void (APIENTRY *bglLightfv)(GLenum light, GLenum pname, const GLfloat *params);
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
// Raster funcs
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
|
|
|
|
void (APIENTRY *bglRasterPos4i)(GLint x, GLint y, GLint z, GLint w);
|
|
|
|
void (APIENTRY *bglDrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
|
2012-04-01 04:24:57 +00:00
|
|
|
void (APIENTRY *bglPixelStorei)(GLenum pname, GLint param);
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
// Texture mapping
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglTexEnvf)(GLenum target, GLenum pname, GLfloat param);
|
|
|
|
void (APIENTRY *bglGenTextures)(GLsizei n, GLuint *textures); // 1.1
|
|
|
|
void (APIENTRY *bglDeleteTextures)(GLsizei n, const GLuint *textures); // 1.1
|
|
|
|
void (APIENTRY *bglBindTexture)(GLenum target, GLuint texture); // 1.1
|
|
|
|
void (APIENTRY *bglTexImage2D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
|
|
|
void (APIENTRY *bglTexImage3D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
|
|
|
void (APIENTRY *bglCopyTexImage2D)(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
|
|
|
void (APIENTRY *bglCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
|
|
|
void (APIENTRY *bglTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); // 1.1
|
|
|
|
void (APIENTRY *bglTexParameterf)(GLenum target, GLenum pname, GLfloat param);
|
|
|
|
void (APIENTRY *bglTexParameteri)(GLenum target, GLenum pname, GLint param);
|
2012-04-10 20:14:52 +00:00
|
|
|
void (APIENTRY *bglGetTexParameteriv)(GLenum target, GLenum pname, GLint *params);
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglGetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params);
|
|
|
|
void (APIENTRY *bglCompressedTexImage2DARB)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
|
|
|
|
void (APIENTRY *bglGetCompressedTexImageARB)(GLenum, GLint, GLvoid *);
|
|
|
|
void (APIENTRY *bglTexGenfv)(GLenum coord, GLenum pname, const GLfloat *params);
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
// Fog
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglFogf)(GLenum pname, GLfloat param);
|
|
|
|
void (APIENTRY *bglFogi)(GLenum pname, GLint param);
|
|
|
|
void (APIENTRY *bglFogfv)(GLenum pname, const GLfloat *params);
|
2006-04-24 19:04:22 +00:00
|
|
|
|
2006-08-30 23:32:39 +00:00
|
|
|
// Display Lists
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglNewList)(GLuint list, GLenum mode);
|
|
|
|
void (APIENTRY *bglEndList)(void);
|
|
|
|
void (APIENTRY *bglCallList)(GLuint list);
|
|
|
|
void (APIENTRY *bglDeleteLists)(GLuint list, GLsizei range);
|
2006-08-30 23:32:39 +00:00
|
|
|
|
2006-09-27 02:23:27 +00:00
|
|
|
// Vertex Arrays
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglEnableClientState)(GLenum cap);
|
|
|
|
void (APIENTRY *bglDisableClientState)(GLenum cap);
|
|
|
|
void (APIENTRY *bglVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
|
|
|
void (APIENTRY *bglNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer);
|
|
|
|
void (APIENTRY *bglTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
|
|
|
void (APIENTRY *bglDrawArrays)(GLenum mode, GLint first, GLsizei count);
|
|
|
|
void (APIENTRY *bglDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
|
2006-09-27 02:23:27 +00:00
|
|
|
|
2006-10-04 09:54:25 +00:00
|
|
|
// Stencil Buffer
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglClearStencil)(GLint s);
|
|
|
|
void (APIENTRY *bglStencilOp)(GLenum fail, GLenum zfail, GLenum zpass);
|
|
|
|
void (APIENTRY *bglStencilFunc)(GLenum func, GLint ref, GLuint mask);
|
2006-10-04 09:54:25 +00:00
|
|
|
|
2006-12-31 06:32:04 +00:00
|
|
|
// GPU Programs
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglGenProgramsARB)(GLsizei, GLuint *);
|
|
|
|
void (APIENTRY *bglBindProgramARB)(GLenum, GLuint);
|
|
|
|
void (APIENTRY *bglProgramStringARB)(GLenum, GLenum, GLsizei, const GLvoid *);
|
|
|
|
void (APIENTRY *bglDeleteProgramsARB)(GLsizei n, const GLuint *programs);
|
2006-12-31 06:32:04 +00:00
|
|
|
|
|
|
|
// Multitexturing
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglActiveTextureARB)(GLenum texture);
|
|
|
|
void (APIENTRY *bglClientActiveTextureARB)(GLenum texture);
|
|
|
|
void (APIENTRY *bglMultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t);
|
|
|
|
void (APIENTRY *bglMultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t);
|
2006-12-31 06:32:04 +00:00
|
|
|
|
2007-01-06 01:29:45 +00:00
|
|
|
// Frame Buffer Objects
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglGenFramebuffersEXT)(GLsizei n, GLuint *framebuffers);
|
|
|
|
void (APIENTRY *bglBindFramebufferEXT)(GLenum target, GLuint framebuffer);
|
|
|
|
void (APIENTRY *bglFramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
|
|
|
GLenum(APIENTRY *bglCheckFramebufferStatusEXT)(GLenum target);
|
|
|
|
void (APIENTRY *bglDeleteFramebuffersEXT)(GLsizei n, const GLuint *framebuffers);
|
2007-12-12 17:42:14 +00:00
|
|
|
|
|
|
|
// Vertex Buffer Objects
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglGenBuffersARB)(GLsizei n, GLuint *buffers);
|
|
|
|
void (APIENTRY *bglBindBufferARB)(GLenum target, GLuint buffer);
|
|
|
|
void (APIENTRY *bglDeleteBuffersARB)(GLsizei n, const GLuint *buffers);
|
|
|
|
void (APIENTRY *bglBufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);
|
|
|
|
void (APIENTRY *bglBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data);
|
|
|
|
void *(APIENTRY *bglMapBufferARB)(GLenum target, GLenum access);
|
|
|
|
GLboolean(APIENTRY *bglUnmapBufferARB)(GLenum target);
|
2007-01-06 01:29:45 +00:00
|
|
|
|
2008-03-26 09:24:25 +00:00
|
|
|
// Occlusion queries
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglGenQueriesARB)(GLsizei n, GLuint *ids);
|
|
|
|
void (APIENTRY *bglDeleteQueriesARB)(GLsizei n, const GLuint *ids);
|
|
|
|
GLboolean(APIENTRY *bglIsQueryARB)(GLuint id);
|
|
|
|
void (APIENTRY *bglBeginQueryARB)(GLenum target, GLuint id);
|
|
|
|
void (APIENTRY *bglEndQueryARB)(GLenum target);
|
|
|
|
void (APIENTRY *bglGetQueryivARB)(GLenum target, GLenum pname, GLint *params);
|
|
|
|
void (APIENTRY *bglGetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params);
|
|
|
|
void (APIENTRY *bglGetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *params);
|
2008-03-26 09:24:25 +00:00
|
|
|
|
2008-11-16 21:46:11 +00:00
|
|
|
// Shader Objects
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglDeleteObjectARB)(GLhandleARB);
|
|
|
|
GLhandleARB(APIENTRY *bglGetHandleARB)(GLenum);
|
|
|
|
void (APIENTRY *bglDetachObjectARB)(GLhandleARB, GLhandleARB);
|
|
|
|
GLhandleARB(APIENTRY *bglCreateShaderObjectARB)(GLenum);
|
|
|
|
void (APIENTRY *bglShaderSourceARB)(GLhandleARB, GLsizei, const GLcharARB* *, const GLint *);
|
|
|
|
void (APIENTRY *bglCompileShaderARB)(GLhandleARB);
|
|
|
|
GLhandleARB(APIENTRY *bglCreateProgramObjectARB)(void);
|
|
|
|
void (APIENTRY *bglAttachObjectARB)(GLhandleARB, GLhandleARB);
|
|
|
|
void (APIENTRY *bglLinkProgramARB)(GLhandleARB);
|
|
|
|
void (APIENTRY *bglUseProgramObjectARB)(GLhandleARB);
|
|
|
|
void (APIENTRY *bglValidateProgramARB)(GLhandleARB);
|
|
|
|
void (APIENTRY *bglUniform1fARB)(GLint, GLfloat);
|
|
|
|
void (APIENTRY *bglUniform2fARB)(GLint, GLfloat, GLfloat);
|
|
|
|
void (APIENTRY *bglUniform3fARB)(GLint, GLfloat, GLfloat, GLfloat);
|
|
|
|
void (APIENTRY *bglUniform4fARB)(GLint, GLfloat, GLfloat, GLfloat, GLfloat);
|
|
|
|
void (APIENTRY *bglUniform1iARB)(GLint, GLint);
|
|
|
|
void (APIENTRY *bglUniform2iARB)(GLint, GLint, GLint);
|
|
|
|
void (APIENTRY *bglUniform3iARB)(GLint, GLint, GLint, GLint);
|
|
|
|
void (APIENTRY *bglUniform4iARB)(GLint, GLint, GLint, GLint, GLint);
|
|
|
|
void (APIENTRY *bglUniform1fvARB)(GLint, GLsizei, const GLfloat *);
|
|
|
|
void (APIENTRY *bglUniform2fvARB)(GLint, GLsizei, const GLfloat *);
|
|
|
|
void (APIENTRY *bglUniform3fvARB)(GLint, GLsizei, const GLfloat *);
|
|
|
|
void (APIENTRY *bglUniform4fvARB)(GLint, GLsizei, const GLfloat *);
|
|
|
|
void (APIENTRY *bglUniform1ivARB)(GLint, GLsizei, const GLint *);
|
|
|
|
void (APIENTRY *bglUniform2ivARB)(GLint, GLsizei, const GLint *);
|
|
|
|
void (APIENTRY *bglUniform3ivARB)(GLint, GLsizei, const GLint *);
|
|
|
|
void (APIENTRY *bglUniform4ivARB)(GLint, GLsizei, const GLint *);
|
|
|
|
void (APIENTRY *bglUniformMatrix2fvARB)(GLint, GLsizei, GLboolean, const GLfloat *);
|
|
|
|
void (APIENTRY *bglUniformMatrix3fvARB)(GLint, GLsizei, GLboolean, const GLfloat *);
|
|
|
|
void (APIENTRY *bglUniformMatrix4fvARB)(GLint, GLsizei, GLboolean, const GLfloat *);
|
|
|
|
void (APIENTRY *bglGetObjectParameterfvARB)(GLhandleARB, GLenum, GLfloat *);
|
|
|
|
void (APIENTRY *bglGetObjectParameterivARB)(GLhandleARB, GLenum, GLint *);
|
|
|
|
void (APIENTRY *bglGetInfoLogARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
|
|
|
|
void (APIENTRY *bglGetAttachedObjectsARB)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *);
|
|
|
|
GLint(APIENTRY *bglGetUniformLocationARB)(GLhandleARB, const GLcharARB *);
|
|
|
|
void (APIENTRY *bglGetActiveUniformARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
|
|
|
|
void (APIENTRY *bglGetUniformfvARB)(GLhandleARB, GLint, GLfloat *);
|
|
|
|
void (APIENTRY *bglGetUniformivARB)(GLhandleARB, GLint, GLint *);
|
|
|
|
void (APIENTRY *bglGetShaderSourceARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
|
2008-11-16 21:46:11 +00:00
|
|
|
|
2008-11-16 22:56:55 +00:00
|
|
|
// Vertex Shaders
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bglVertexAttrib1dARB)(GLuint, GLdouble);
|
|
|
|
void (APIENTRY *bglVertexAttrib1dvARB)(GLuint, const GLdouble *);
|
|
|
|
void (APIENTRY *bglVertexAttrib1fARB)(GLuint, GLfloat);
|
|
|
|
void (APIENTRY *bglVertexAttrib1fvARB)(GLuint, const GLfloat *);
|
|
|
|
void (APIENTRY *bglVertexAttrib1sARB)(GLuint, GLshort);
|
|
|
|
void (APIENTRY *bglVertexAttrib1svARB)(GLuint, const GLshort *);
|
|
|
|
void (APIENTRY *bglVertexAttrib2dARB)(GLuint, GLdouble, GLdouble);
|
|
|
|
void (APIENTRY *bglVertexAttrib2dvARB)(GLuint, const GLdouble *);
|
|
|
|
void (APIENTRY *bglVertexAttrib2fARB)(GLuint, GLfloat, GLfloat);
|
|
|
|
void (APIENTRY *bglVertexAttrib2fvARB)(GLuint, const GLfloat *);
|
|
|
|
void (APIENTRY *bglVertexAttrib2sARB)(GLuint, GLshort, GLshort);
|
|
|
|
void (APIENTRY *bglVertexAttrib2svARB)(GLuint, const GLshort *);
|
|
|
|
void (APIENTRY *bglVertexAttrib3dARB)(GLuint, GLdouble, GLdouble, GLdouble);
|
|
|
|
void (APIENTRY *bglVertexAttrib3dvARB)(GLuint, const GLdouble *);
|
|
|
|
void (APIENTRY *bglVertexAttrib3fARB)(GLuint, GLfloat, GLfloat, GLfloat);
|
|
|
|
void (APIENTRY *bglVertexAttrib3fvARB)(GLuint, const GLfloat *);
|
|
|
|
void (APIENTRY *bglVertexAttrib3sARB)(GLuint, GLshort, GLshort, GLshort);
|
|
|
|
void (APIENTRY *bglVertexAttrib3svARB)(GLuint, const GLshort *);
|
|
|
|
void (APIENTRY *bglVertexAttrib4NbvARB)(GLuint, const GLbyte *);
|
|
|
|
void (APIENTRY *bglVertexAttrib4NivARB)(GLuint, const GLint *);
|
|
|
|
void (APIENTRY *bglVertexAttrib4NsvARB)(GLuint, const GLshort *);
|
|
|
|
void (APIENTRY *bglVertexAttrib4NubARB)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
|
|
|
|
void (APIENTRY *bglVertexAttrib4NubvARB)(GLuint, const GLubyte *);
|
|
|
|
void (APIENTRY *bglVertexAttrib4NuivARB)(GLuint, const GLuint *);
|
|
|
|
void (APIENTRY *bglVertexAttrib4NusvARB)(GLuint, const GLushort *);
|
|
|
|
void (APIENTRY *bglVertexAttrib4bvARB)(GLuint, const GLbyte *);
|
|
|
|
void (APIENTRY *bglVertexAttrib4dARB)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
|
|
|
|
void (APIENTRY *bglVertexAttrib4dvARB)(GLuint, const GLdouble *);
|
|
|
|
void (APIENTRY *bglVertexAttrib4fARB)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
|
|
|
|
void (APIENTRY *bglVertexAttrib4fvARB)(GLuint, const GLfloat *);
|
|
|
|
void (APIENTRY *bglVertexAttrib4ivARB)(GLuint, const GLint *);
|
|
|
|
void (APIENTRY *bglVertexAttrib4sARB)(GLuint, GLshort, GLshort, GLshort, GLshort);
|
|
|
|
void (APIENTRY *bglVertexAttrib4svARB)(GLuint, const GLshort *);
|
|
|
|
void (APIENTRY *bglVertexAttrib4ubvARB)(GLuint, const GLubyte *);
|
|
|
|
void (APIENTRY *bglVertexAttrib4uivARB)(GLuint, const GLuint *);
|
|
|
|
void (APIENTRY *bglVertexAttrib4usvARB)(GLuint, const GLushort *);
|
|
|
|
void (APIENTRY *bglVertexAttribPointerARB)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
|
|
|
|
void (APIENTRY *bglEnableVertexAttribArrayARB)(GLuint);
|
|
|
|
void (APIENTRY *bglDisableVertexAttribArrayARB)(GLuint);
|
|
|
|
void (APIENTRY *bglGetVertexAttribdvARB)(GLuint, GLenum, GLdouble *);
|
|
|
|
void (APIENTRY *bglGetVertexAttribfvARB)(GLuint, GLenum, GLfloat *);
|
|
|
|
void (APIENTRY *bglGetVertexAttribivARB)(GLuint, GLenum, GLint *);
|
|
|
|
void (APIENTRY *bglGetVertexAttribPointervARB)(GLuint, GLenum, GLvoid* *);
|
|
|
|
void (APIENTRY *bglBindAttribLocationARB)(GLhandleARB, GLuint, const GLcharARB *);
|
|
|
|
void (APIENTRY *bglGetActiveAttribARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
|
|
|
|
GLint(APIENTRY *bglGetAttribLocationARB)(GLhandleARB, const GLcharARB *);
|
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__
|
2011-10-02 05:56:35 +00:00
|
|
|
void (APIENTRY * bglDebugMessageControlARB)(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
|
|
|
|
void (APIENTRY * bglDebugMessageCallbackARB)(GLDEBUGPROCARB callback, const GLvoid *userParam);
|
2011-10-11 16:52:53 +00:00
|
|
|
#endif
|
2011-10-02 05:56:35 +00:00
|
|
|
|
2007-01-16 03:19:04 +00:00
|
|
|
// GLU
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bgluTessBeginContour)(GLUtesselator *tess);
|
|
|
|
void (APIENTRY *bgluTessBeginPolygon)(GLUtesselator *tess, GLvoid *data);
|
|
|
|
void (APIENTRY *bgluTessCallback)(GLUtesselator *tess, GLenum which, void (PR_CALLBACK CallBackFunc)());
|
|
|
|
void (APIENTRY *bgluTessEndContour)(GLUtesselator *tess);
|
|
|
|
void (APIENTRY *bgluTessEndPolygon)(GLUtesselator *tess);
|
|
|
|
void (APIENTRY *bgluTessNormal)(GLUtesselator *tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ);
|
|
|
|
void (APIENTRY *bgluTessProperty)(GLUtesselator *tess, GLenum which, GLdouble data);
|
|
|
|
void (APIENTRY *bgluTessVertex)(GLUtesselator *tess, GLdouble *location, GLvoid *data);
|
|
|
|
GLUtesselator *(APIENTRY *bgluNewTess)(void);
|
2011-07-22 22:00:53 +00:00
|
|
|
void (APIENTRY * bgluDeleteTess)(GLUtesselator *tess);
|
2007-07-01 06:32:03 +00:00
|
|
|
|
2011-01-16 02:50:27 +00:00
|
|
|
void (APIENTRY *bgluPerspective)(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
|
2007-07-01 06:32:03 +00:00
|
|
|
|
2011-01-16 02:50:27 +00:00
|
|
|
const GLubyte *(APIENTRY *bgluErrorString)(GLenum error);
|
2007-01-16 03:19:04 +00:00
|
|
|
|
2011-01-16 02:50:27 +00:00
|
|
|
GLint(APIENTRY *bgluProject)(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble *winX, GLdouble *winY, GLdouble *winZ);
|
|
|
|
GLint(APIENTRY *bgluUnProject)(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble *objX, GLdouble *objY, GLdouble *objZ);
|
2009-07-11 22:20:15 +00:00
|
|
|
|
2007-07-01 06:32:03 +00:00
|
|
|
|
2006-04-23 06:44:19 +00:00
|
|
|
#ifdef RENDERTYPEWIN
|
|
|
|
// Windows
|
2011-01-16 02:50:27 +00:00
|
|
|
HGLRC(WINAPI *bwglCreateContext)(HDC);
|
|
|
|
BOOL (WINAPI *bwglDeleteContext)(HGLRC);
|
|
|
|
PROC(WINAPI *bwglGetProcAddress)(LPCSTR);
|
|
|
|
BOOL (WINAPI *bwglMakeCurrent)(HDC,HGLRC);
|
|
|
|
|
|
|
|
BOOL (WINAPI *bwglSwapBuffers)(HDC);
|
|
|
|
int32_t (WINAPI *bwglChoosePixelFormat)(HDC,CONST PIXELFORMATDESCRIPTOR *);
|
|
|
|
int32_t (WINAPI *bwglDescribePixelFormat)(HDC,int32_t,UINT,LPPIXELFORMATDESCRIPTOR);
|
|
|
|
int32_t (WINAPI *bwglGetPixelFormat)(HDC);
|
|
|
|
BOOL (WINAPI *bwglSetPixelFormat)(HDC,int32_t,const PIXELFORMATDESCRIPTOR *);
|
|
|
|
BOOL (WINAPI *bwglSwapIntervalEXT)(int32_t);
|
2011-10-03 00:14:56 +00:00
|
|
|
HGLRC (WINAPI * bwglCreateContextAttribsARB)(HDC hDC, HGLRC hShareContext, const int *attribList);
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2007-01-16 03:19:04 +00:00
|
|
|
static HANDLE hGLDLL, hGLUDLL;
|
|
|
|
#else
|
|
|
|
#include <dlfcn.h>
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2007-01-16 03:19:04 +00:00
|
|
|
static void *gluhandle = NULL;
|
|
|
|
#endif
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2007-01-16 03:19:04 +00:00
|
|
|
char *gldriver = NULL, *glulibrary = 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)
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t loadgldriver(const char *driver)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t err=0;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
2006-04-23 06:44:19 +00:00
|
|
|
#ifdef RENDERTYPEWIN
|
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";
|
2006-07-01 01:40:18 +00:00
|
|
|
#elif defined __APPLE__
|
2006-08-31 01:56:43 +00:00
|
|
|
driver = "/System/Library/Frameworks/OpenGL.framework/OpenGL";
|
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
|
|
|
|
|
|
|
#if defined RENDERTYPESDL
|
2010-05-16 22:53:08 +00:00
|
|
|
if (SDL_GL_LoadLibrary(driver)) goto fail;
|
2006-04-23 06:44:19 +00:00
|
|
|
#elif defined _WIN32
|
2006-04-24 19:04:22 +00:00
|
|
|
hGLDLL = LoadLibrary(driver);
|
2010-05-16 22:53:08 +00:00
|
|
|
if (!hGLDLL) goto fail;
|
2006-04-23 06:44:19 +00:00
|
|
|
#endif
|
2009-10-07 06:47:35 +00:00
|
|
|
gldriver = Bstrdup(driver);
|
2006-04-23 06:44:19 +00:00
|
|
|
|
|
|
|
#ifdef RENDERTYPEWIN
|
2006-04-24 19:04:22 +00:00
|
|
|
bwglCreateContext = GETPROC("wglCreateContext");
|
|
|
|
bwglDeleteContext = GETPROC("wglDeleteContext");
|
|
|
|
bwglGetProcAddress = GETPROC("wglGetProcAddress");
|
|
|
|
bwglMakeCurrent = GETPROC("wglMakeCurrent");
|
|
|
|
|
|
|
|
bwglSwapBuffers = GETPROC("wglSwapBuffers");
|
|
|
|
bwglChoosePixelFormat = GETPROC("wglChoosePixelFormat");
|
|
|
|
bwglDescribePixelFormat = GETPROC("wglDescribePixelFormat");
|
|
|
|
bwglGetPixelFormat = GETPROC("wglGetPixelFormat");
|
|
|
|
bwglSetPixelFormat = GETPROC("wglSetPixelFormat");
|
2006-04-23 06:44:19 +00:00
|
|
|
#endif
|
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
bglClearColor = GETPROC("glClearColor");
|
2007-01-14 07:00:29 +00:00
|
|
|
bglClear = GETPROC("glClear");
|
2006-04-24 19:04:22 +00:00
|
|
|
bglColorMask = GETPROC("glColorMask");
|
|
|
|
bglAlphaFunc = GETPROC("glAlphaFunc");
|
|
|
|
bglBlendFunc = GETPROC("glBlendFunc");
|
2007-01-14 07:00:29 +00:00
|
|
|
bglCullFace = GETPROC("glCullFace");
|
2006-04-24 19:04:22 +00:00
|
|
|
bglFrontFace = GETPROC("glFrontFace");
|
|
|
|
bglPolygonOffset = GETPROC("glPolygonOffset");
|
|
|
|
bglPolygonMode = GETPROC("glPolygonMode");
|
2007-01-14 07:00:29 +00:00
|
|
|
bglEnable = GETPROC("glEnable");
|
|
|
|
bglDisable = GETPROC("glDisable");
|
2007-03-22 18:28:41 +00:00
|
|
|
bglGetDoublev = GETPROC("glGetDoublev");
|
2006-04-24 19:04:22 +00:00
|
|
|
bglGetFloatv = GETPROC("glGetFloatv");
|
|
|
|
bglGetIntegerv = GETPROC("glGetIntegerv");
|
|
|
|
bglPushAttrib = GETPROC("glPushAttrib");
|
|
|
|
bglPopAttrib = GETPROC("glPopAttrib");
|
2007-01-14 07:00:29 +00:00
|
|
|
bglGetError = GETPROC("glGetError");
|
2006-04-24 19:04:22 +00:00
|
|
|
bglGetString = GETPROC("glGetString");
|
2007-01-14 07:00:29 +00:00
|
|
|
bglHint = GETPROC("glHint");
|
2007-12-12 17:42:14 +00:00
|
|
|
bglDrawBuffer = GETPROC("glDrawBuffer");
|
|
|
|
bglReadBuffer = GETPROC("glDrawBuffer");
|
|
|
|
bglScissor = GETPROC("glScissor");
|
2008-04-06 23:35:48 +00:00
|
|
|
bglClipPlane = GETPROC("glClipPlane");
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Depth
|
|
|
|
bglDepthFunc = GETPROC("glDepthFunc");
|
|
|
|
bglDepthMask = GETPROC("glDepthMask");
|
|
|
|
bglDepthRange = GETPROC("glDepthRange");
|
|
|
|
|
|
|
|
// Matrix
|
|
|
|
bglMatrixMode = GETPROC("glMatrixMode");
|
|
|
|
bglOrtho = GETPROC("glOrtho");
|
|
|
|
bglFrustum = GETPROC("glFrustum");
|
|
|
|
bglViewport = GETPROC("glViewport");
|
|
|
|
bglPushMatrix = GETPROC("glPushMatrix");
|
|
|
|
bglPopMatrix = GETPROC("glPopMatrix");
|
|
|
|
bglLoadIdentity = GETPROC("glLoadIdentity");
|
|
|
|
bglLoadMatrixf = GETPROC("glLoadMatrixf");
|
2007-03-22 18:28:41 +00:00
|
|
|
bglLoadMatrixd = GETPROC("glLoadMatrixd");
|
2006-10-15 18:51:41 +00:00
|
|
|
bglMultMatrixf = GETPROC("glMultMatrixf");
|
2007-03-22 18:28:41 +00:00
|
|
|
bglMultMatrixd = GETPROC("glMultMatrixd");
|
2006-08-29 01:58:59 +00:00
|
|
|
bglRotatef = GETPROC("glRotatef");
|
2006-08-30 23:32:39 +00:00
|
|
|
bglScalef = GETPROC("glScalef");
|
|
|
|
bglTranslatef = GETPROC("glTranslatef");
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Drawing
|
2007-01-06 01:29:45 +00:00
|
|
|
bglBegin = GETPROC("glBegin");
|
|
|
|
bglEnd = GETPROC("glEnd");
|
|
|
|
bglVertex2f = GETPROC("glVertex2f");
|
|
|
|
bglVertex2i = GETPROC("glVertex2i");
|
|
|
|
bglVertex3f = GETPROC("glVertex3f");
|
|
|
|
bglVertex3d = GETPROC("glVertex3d");
|
|
|
|
bglVertex3fv = GETPROC("glVertex3fv");
|
|
|
|
bglVertex3dv = GETPROC("glVertex3dv");
|
|
|
|
bglColor4f = GETPROC("glColor4f");
|
|
|
|
bglColor4ub = GETPROC("glColor4ub");
|
|
|
|
bglTexCoord2d = GETPROC("glTexCoord2d");
|
|
|
|
bglTexCoord2f = GETPROC("glTexCoord2f");
|
2008-11-05 11:49:13 +00:00
|
|
|
bglTexCoord2i = GETPROC("glTexCoord2i");
|
2008-11-29 20:16:19 +00:00
|
|
|
bglNormal3f = GETPROC("glNormal3f");
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Lighting
|
|
|
|
bglShadeModel = GETPROC("glShadeModel");
|
2009-01-23 10:59:18 +00:00
|
|
|
bglLightfv = GETPROC("glLightfv");
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Raster funcs
|
|
|
|
bglReadPixels = GETPROC("glReadPixels");
|
2008-06-09 02:36:45 +00:00
|
|
|
bglRasterPos4i = GETPROC("glRasterPos4i");
|
|
|
|
bglDrawPixels = GETPROC("glDrawPixels");
|
2012-04-01 04:24:57 +00:00
|
|
|
bglPixelStorei = GETPROC("glPixelStorei");
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Texture mapping
|
2007-01-06 01:29:45 +00:00
|
|
|
bglTexEnvf = GETPROC("glTexEnvf");
|
2006-04-24 19:04:22 +00:00
|
|
|
bglGenTextures = GETPROC("glGenTextures");
|
|
|
|
bglDeleteTextures = GETPROC("glDeleteTextures");
|
|
|
|
bglBindTexture = GETPROC("glBindTexture");
|
|
|
|
bglTexImage2D = GETPROC("glTexImage2D");
|
2006-12-31 06:32:04 +00:00
|
|
|
bglCopyTexImage2D = GETPROC("glCopyTexImage2D");
|
|
|
|
bglCopyTexSubImage2D= GETPROC("glCopyTexSubImage2D");
|
2006-04-24 19:04:22 +00:00
|
|
|
bglTexSubImage2D = GETPROC("glTexSubImage2D");
|
|
|
|
bglTexParameterf = GETPROC("glTexParameterf");
|
|
|
|
bglTexParameteri = GETPROC("glTexParameteri");
|
2012-04-10 20:14:52 +00:00
|
|
|
bglGetTexParameteriv = GETPROC("glGetTexParameteriv");
|
2006-04-24 19:04:22 +00:00
|
|
|
bglGetTexLevelParameteriv = GETPROC("glGetTexLevelParameteriv");
|
2006-08-31 01:56:43 +00:00
|
|
|
bglTexGenfv = GETPROC("glTexGenfv");
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Fog
|
|
|
|
bglFogf = GETPROC("glFogf");
|
|
|
|
bglFogi = GETPROC("glFogi");
|
|
|
|
bglFogfv = GETPROC("glFogfv");
|
|
|
|
|
2006-08-30 23:32:39 +00:00
|
|
|
// Display Lists
|
2007-01-06 01:29:45 +00:00
|
|
|
bglNewList = GETPROC("glNewList");
|
|
|
|
bglEndList = GETPROC("glEndList");
|
|
|
|
bglCallList = GETPROC("glCallList");
|
|
|
|
bglDeleteLists = GETPROC("glDeleteLists");
|
2006-08-30 23:32:39 +00:00
|
|
|
|
2006-09-27 02:23:27 +00:00
|
|
|
// Vertex Arrays
|
|
|
|
bglEnableClientState = GETPROC("glEnableClientState");
|
|
|
|
bglDisableClientState = GETPROC("glDisableClientState");
|
|
|
|
bglVertexPointer = GETPROC("glVertexPointer");
|
2008-06-06 14:00:12 +00:00
|
|
|
bglNormalPointer = GETPROC("glNormalPointer");
|
2006-09-27 02:23:27 +00:00
|
|
|
bglTexCoordPointer = GETPROC("glTexCoordPointer");
|
2006-09-29 21:36:12 +00:00
|
|
|
bglDrawArrays = GETPROC("glDrawArrays");
|
2006-09-27 02:23:27 +00:00
|
|
|
bglDrawElements = GETPROC("glDrawElements");
|
|
|
|
|
2006-10-04 09:54:25 +00:00
|
|
|
// Stencil Buffer
|
|
|
|
bglClearStencil = GETPROC("glClearStencil");
|
|
|
|
bglStencilOp = GETPROC("glStencilOp");
|
|
|
|
bglStencilFunc = GETPROC("glStencilFunc");
|
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
|
|
|
|
|
|
|
if (err) unloadgldriver();
|
|
|
|
return err;
|
2010-05-16 22:53:08 +00:00
|
|
|
|
|
|
|
fail:
|
|
|
|
initprintf("Failed loading \"%s\"\n",driver);
|
|
|
|
return -1;
|
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
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t err = 0;
|
2006-04-23 06:44:19 +00:00
|
|
|
#ifdef RENDERTYPEWIN
|
2006-04-24 19:04:22 +00:00
|
|
|
if (!hGLDLL) return 0;
|
2006-04-23 06:44:19 +00:00
|
|
|
#endif
|
|
|
|
|
2012-10-21 04:52:43 +00:00
|
|
|
bglBlendEquation = GETPROCEXTSOFT("glBlendEquation");
|
|
|
|
|
2010-12-29 20:46:11 +00:00
|
|
|
bglTexImage3D = GETPROCEXTSOFT("glTexImage3D");
|
2006-04-24 19:04:22 +00:00
|
|
|
bglCompressedTexImage2DARB = GETPROCEXTSOFT("glCompressedTexImage2DARB");
|
|
|
|
bglGetCompressedTexImageARB = GETPROCEXTSOFT("glGetCompressedTexImageARB");
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2006-12-31 06:32:04 +00:00
|
|
|
// GPU Programs
|
|
|
|
bglGenProgramsARB = GETPROCEXTSOFT("glGenProgramsARB");
|
|
|
|
bglBindProgramARB = GETPROCEXTSOFT("glBindProgramARB");
|
|
|
|
bglProgramStringARB = GETPROCEXTSOFT("glProgramStringARB");
|
2007-01-06 01:29:45 +00:00
|
|
|
bglDeleteProgramsARB= GETPROCEXTSOFT("glDeleteProgramsARB");
|
2006-12-31 06:32:04 +00:00
|
|
|
|
|
|
|
// Multitexturing
|
2007-03-03 23:09:40 +00:00
|
|
|
bglActiveTextureARB = GETPROCEXTSOFT("glActiveTextureARB");
|
|
|
|
bglClientActiveTextureARB = GETPROCEXTSOFT("glClientActiveTextureARB");
|
|
|
|
bglMultiTexCoord2dARB = GETPROCEXTSOFT("glMultiTexCoord2dARB");
|
|
|
|
bglMultiTexCoord2fARB = GETPROCEXTSOFT("glMultiTexCoord2fARB");
|
2006-12-31 06:32:04 +00:00
|
|
|
|
2007-01-06 01:29:45 +00:00
|
|
|
// Frame Buffer Objects
|
|
|
|
bglGenFramebuffersEXT = GETPROCEXTSOFT("glGenFramebuffersEXT");
|
2007-12-12 17:42:14 +00:00
|
|
|
bglBindFramebufferEXT = GETPROCEXTSOFT("glBindFramebufferEXT");
|
|
|
|
bglFramebufferTexture2DEXT = GETPROCEXTSOFT("glFramebufferTexture2DEXT");
|
|
|
|
bglCheckFramebufferStatusEXT = GETPROCEXTSOFT("glCheckFramebufferStatusEXT");
|
|
|
|
bglDeleteFramebuffersEXT = GETPROCEXTSOFT("glDeleteFramebuffersEXT");
|
|
|
|
|
|
|
|
// Vertex Buffer Objects
|
|
|
|
bglGenBuffersARB = GETPROCEXTSOFT("glGenBuffersARB");
|
|
|
|
bglBindBufferARB = GETPROCEXTSOFT("glBindBufferARB");
|
|
|
|
bglDeleteBuffersARB = GETPROCEXTSOFT("glDeleteBuffersARB");
|
2007-03-08 03:07:10 +00:00
|
|
|
bglBufferDataARB = GETPROCEXTSOFT("glBufferDataARB");
|
2008-05-24 09:37:09 +00:00
|
|
|
bglBufferSubDataARB = GETPROCEXTSOFT("glBufferSubDataARB");
|
2007-03-08 03:07:10 +00:00
|
|
|
bglMapBufferARB = GETPROCEXTSOFT("glMapBufferARB");
|
|
|
|
bglUnmapBufferARB = GETPROCEXTSOFT("glUnmapBufferARB");
|
2007-12-12 17:42:14 +00:00
|
|
|
|
2008-03-26 09:24:25 +00:00
|
|
|
// Occlusion queries
|
|
|
|
bglGenQueriesARB = GETPROCEXTSOFT("glGenQueriesARB");
|
|
|
|
bglDeleteQueriesARB = GETPROCEXTSOFT("glDeleteQueriesARB");
|
|
|
|
bglIsQueryARB = GETPROCEXTSOFT("glIsQueryARB");
|
|
|
|
bglBeginQueryARB = GETPROCEXTSOFT("glBeginQueryARB");
|
|
|
|
bglEndQueryARB = GETPROCEXTSOFT("glEndQueryARB");
|
|
|
|
bglGetQueryivARB = GETPROCEXTSOFT("glGetQueryivARB");
|
|
|
|
bglGetQueryObjectivARB = GETPROCEXTSOFT("glGetQueryObjectivARB");
|
|
|
|
bglGetQueryObjectuivARB = GETPROCEXTSOFT("glGetQueryObjectuivARB");
|
|
|
|
|
2008-11-16 21:46:11 +00:00
|
|
|
// Shader Objects
|
|
|
|
bglDeleteObjectARB = GETPROCEXTSOFT("glDeleteObjectARB");
|
|
|
|
bglGetHandleARB = GETPROCEXTSOFT("glGetHandleARB");
|
|
|
|
bglDetachObjectARB = GETPROCEXTSOFT("glDetachObjectARB");
|
|
|
|
bglCreateShaderObjectARB = GETPROCEXTSOFT("glCreateShaderObjectARB");
|
|
|
|
bglShaderSourceARB = GETPROCEXTSOFT("glShaderSourceARB");
|
|
|
|
bglCompileShaderARB = GETPROCEXTSOFT("glCompileShaderARB");
|
|
|
|
bglCreateProgramObjectARB = GETPROCEXTSOFT("glCreateProgramObjectARB");
|
|
|
|
bglAttachObjectARB = GETPROCEXTSOFT("glAttachObjectARB");
|
|
|
|
bglLinkProgramARB = GETPROCEXTSOFT("glLinkProgramARB");
|
|
|
|
bglUseProgramObjectARB = GETPROCEXTSOFT("glUseProgramObjectARB");
|
|
|
|
bglValidateProgramARB = GETPROCEXTSOFT("glValidateProgramARB");
|
|
|
|
bglUniform1fARB = GETPROCEXTSOFT("glUniform1fARB");
|
|
|
|
bglUniform2fARB = GETPROCEXTSOFT("glUniform2fARB");
|
|
|
|
bglUniform3fARB = GETPROCEXTSOFT("glUniform3fARB");
|
|
|
|
bglUniform4fARB = GETPROCEXTSOFT("glUniform4fARB");
|
|
|
|
bglUniform1iARB = GETPROCEXTSOFT("glUniform1iARB");
|
|
|
|
bglUniform2iARB = GETPROCEXTSOFT("glUniform2iARB");
|
|
|
|
bglUniform3iARB = GETPROCEXTSOFT("glUniform3iARB");
|
|
|
|
bglUniform4iARB = GETPROCEXTSOFT("glUniform4iARB");
|
|
|
|
bglUniform1fvARB = GETPROCEXTSOFT("glUniform1fvARB");
|
|
|
|
bglUniform2fvARB = GETPROCEXTSOFT("glUniform2fvARB");
|
|
|
|
bglUniform3fvARB = GETPROCEXTSOFT("glUniform3fvARB");
|
|
|
|
bglUniform4fvARB = GETPROCEXTSOFT("glUniform4fvARB");
|
|
|
|
bglUniform1ivARB = GETPROCEXTSOFT("glUniform1ivARB");
|
|
|
|
bglUniform2ivARB = GETPROCEXTSOFT("glUniform2ivARB");
|
|
|
|
bglUniform3ivARB = GETPROCEXTSOFT("glUniform3ivARB");
|
|
|
|
bglUniform4ivARB = GETPROCEXTSOFT("glUniform4ivARB");
|
|
|
|
bglUniformMatrix2fvARB = GETPROCEXTSOFT("glUniformMatrix2fvARB");
|
|
|
|
bglUniformMatrix3fvARB = GETPROCEXTSOFT("glUniformMatrix3fvARB");
|
|
|
|
bglUniformMatrix4fvARB = GETPROCEXTSOFT("glUniformMatrix4fvARB");
|
|
|
|
bglGetObjectParameterfvARB = GETPROCEXTSOFT("glGetObjectParameterfvARB");
|
|
|
|
bglGetObjectParameterivARB = GETPROCEXTSOFT("glGetObjectParameterivARB");
|
|
|
|
bglGetInfoLogARB = GETPROCEXTSOFT("glGetInfoLogARB");
|
|
|
|
bglGetAttachedObjectsARB = GETPROCEXTSOFT("glGetAttachedObjectsARB");
|
|
|
|
bglGetUniformLocationARB = GETPROCEXTSOFT("glGetUniformLocationARB");
|
|
|
|
bglGetActiveUniformARB = GETPROCEXTSOFT("glGetActiveUniformARB");
|
|
|
|
bglGetUniformfvARB = GETPROCEXTSOFT("glGetUniformfvARB");
|
|
|
|
bglGetUniformivARB = GETPROCEXTSOFT("glGetUniformivARB");
|
|
|
|
bglGetShaderSourceARB = GETPROCEXTSOFT("glGetShaderSourceARB");
|
|
|
|
|
2008-11-16 22:56:55 +00:00
|
|
|
// Vertex Shaders
|
|
|
|
bglVertexAttrib1dARB = GETPROCEXTSOFT("glVertexAttrib1dARB");
|
|
|
|
bglVertexAttrib1dvARB = GETPROCEXTSOFT("glVertexAttrib1dvARB");
|
|
|
|
bglVertexAttrib1fARB = GETPROCEXTSOFT("glVertexAttrib1fARB");
|
|
|
|
bglVertexAttrib1fvARB = GETPROCEXTSOFT("glVertexAttrib1fvARB");
|
|
|
|
bglVertexAttrib1sARB = GETPROCEXTSOFT("glVertexAttrib1sARB");
|
|
|
|
bglVertexAttrib1svARB = GETPROCEXTSOFT("glVertexAttrib1svARB");
|
|
|
|
bglVertexAttrib2dARB = GETPROCEXTSOFT("glVertexAttrib2dARB");
|
|
|
|
bglVertexAttrib2dvARB = GETPROCEXTSOFT("glVertexAttrib2dvARB");
|
|
|
|
bglVertexAttrib2fARB = GETPROCEXTSOFT("glVertexAttrib2fARB");
|
|
|
|
bglVertexAttrib2fvARB = GETPROCEXTSOFT("glVertexAttrib2fvARB");
|
|
|
|
bglVertexAttrib2sARB = GETPROCEXTSOFT("glVertexAttrib2sARB");
|
|
|
|
bglVertexAttrib2svARB = GETPROCEXTSOFT("glVertexAttrib2svARB");
|
|
|
|
bglVertexAttrib3dARB = GETPROCEXTSOFT("glVertexAttrib3dARB");
|
|
|
|
bglVertexAttrib3dvARB = GETPROCEXTSOFT("glVertexAttrib3dvARB");
|
|
|
|
bglVertexAttrib3fARB = GETPROCEXTSOFT("glVertexAttrib3fARB");
|
|
|
|
bglVertexAttrib3fvARB = GETPROCEXTSOFT("glVertexAttrib3fvARB");
|
|
|
|
bglVertexAttrib3sARB = GETPROCEXTSOFT("glVertexAttrib3sARB");
|
|
|
|
bglVertexAttrib3svARB = GETPROCEXTSOFT("glVertexAttrib3svARB");
|
|
|
|
bglVertexAttrib4NbvARB = GETPROCEXTSOFT("glVertexAttrib4NbvARB");
|
|
|
|
bglVertexAttrib4NivARB = GETPROCEXTSOFT("glVertexAttrib4NivARB");
|
|
|
|
bglVertexAttrib4NsvARB = GETPROCEXTSOFT("glVertexAttrib4NsvARB");
|
|
|
|
bglVertexAttrib4NubARB = GETPROCEXTSOFT("glVertexAttrib4NubARB");
|
|
|
|
bglVertexAttrib4NubvARB = GETPROCEXTSOFT("glVertexAttrib4NubvARB");
|
|
|
|
bglVertexAttrib4NuivARB = GETPROCEXTSOFT("glVertexAttrib4NuivARB");
|
|
|
|
bglVertexAttrib4NusvARB = GETPROCEXTSOFT("glVertexAttrib4NusvARB");
|
|
|
|
bglVertexAttrib4bvARB = GETPROCEXTSOFT("glVertexAttrib4bvARB");
|
|
|
|
bglVertexAttrib4dARB = GETPROCEXTSOFT("glVertexAttrib4dARB");
|
|
|
|
bglVertexAttrib4dvARB = GETPROCEXTSOFT("glVertexAttrib4dvARB");
|
|
|
|
bglVertexAttrib4fARB = GETPROCEXTSOFT("glVertexAttrib4fARB");
|
|
|
|
bglVertexAttrib4fvARB = GETPROCEXTSOFT("glVertexAttrib4fvARB");
|
|
|
|
bglVertexAttrib4ivARB = GETPROCEXTSOFT("glVertexAttrib4ivARB");
|
|
|
|
bglVertexAttrib4sARB = GETPROCEXTSOFT("glVertexAttrib4sARB");
|
|
|
|
bglVertexAttrib4svARB = GETPROCEXTSOFT("glVertexAttrib4svARB");
|
|
|
|
bglVertexAttrib4ubvARB = GETPROCEXTSOFT("glVertexAttrib4ubvARB");
|
|
|
|
bglVertexAttrib4uivARB = GETPROCEXTSOFT("glVertexAttrib4uivARB");
|
|
|
|
bglVertexAttrib4usvARB = GETPROCEXTSOFT("glVertexAttrib4usvARB");
|
|
|
|
bglVertexAttribPointerARB = GETPROCEXTSOFT("glVertexAttribPointerARB");
|
|
|
|
bglEnableVertexAttribArrayARB = GETPROCEXTSOFT("glEnableVertexAttribArrayARB");
|
|
|
|
bglDisableVertexAttribArrayARB = GETPROCEXTSOFT("glDisableVertexAttribArrayARB");
|
|
|
|
bglGetVertexAttribdvARB = GETPROCEXTSOFT("glGetVertexAttribdvARB");
|
|
|
|
bglGetVertexAttribfvARB = GETPROCEXTSOFT("glGetVertexAttribfvARB");
|
|
|
|
bglGetVertexAttribivARB = GETPROCEXTSOFT("glGetVertexAttribivARB");
|
|
|
|
bglGetVertexAttribPointervARB = GETPROCEXTSOFT("glGetVertexAttribPointervARB");
|
|
|
|
bglBindAttribLocationARB = GETPROCEXTSOFT("glBindAttribLocationARB");
|
|
|
|
bglGetActiveAttribARB = GETPROCEXTSOFT("glGetActiveAttribARB");
|
|
|
|
bglGetAttribLocationARB = GETPROCEXTSOFT("glGetAttribLocationARB");
|
|
|
|
|
2011-10-02 05:56:35 +00:00
|
|
|
// Debug Output
|
2011-10-11 16:52:53 +00:00
|
|
|
#ifndef __APPLE__
|
2011-10-02 05:56:35 +00:00
|
|
|
bglDebugMessageControlARB = GETPROCEXTSOFT("glDebugMessageControlARB");
|
|
|
|
bglDebugMessageCallbackARB = GETPROCEXTSOFT("glDebugMessageCallbackARB");
|
2011-10-11 16:52:53 +00:00
|
|
|
#endif
|
2011-10-02 05:56:35 +00:00
|
|
|
|
2008-07-22 21:03:09 +00:00
|
|
|
#ifdef RENDERTYPEWIN
|
|
|
|
bwglSwapIntervalEXT = GETPROCEXTSOFT("wglSwapIntervalEXT");
|
2011-10-03 00:14:56 +00:00
|
|
|
bwglCreateContextAttribsARB = GETPROCEXTSOFT("wglCreateContextAttribsARB");
|
2008-07-22 21:03:09 +00:00
|
|
|
#endif
|
2006-04-24 19:04:22 +00:00
|
|
|
return err;
|
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
|
|
|
|
2006-04-23 06:44:19 +00:00
|
|
|
#ifdef RENDERTYPEWIN
|
2006-04-24 19:04:22 +00:00
|
|
|
if (!hGLDLL) return 0;
|
2006-04-23 06:44:19 +00:00
|
|
|
#endif
|
|
|
|
|
2009-10-07 06:47:35 +00:00
|
|
|
Bfree(gldriver);
|
2006-04-24 19:04:22 +00:00
|
|
|
gldriver = NULL;
|
|
|
|
|
2006-04-23 06:44:19 +00:00
|
|
|
#ifdef RENDERTYPEWIN
|
2006-04-24 19:04:22 +00:00
|
|
|
FreeLibrary(hGLDLL);
|
|
|
|
hGLDLL = NULL;
|
2006-04-23 06:44:19 +00:00
|
|
|
#endif
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
bglClearColor = NULL;
|
2006-10-15 18:51:41 +00:00
|
|
|
bglClear = NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
bglColorMask = NULL;
|
|
|
|
bglAlphaFunc = NULL;
|
|
|
|
bglBlendFunc = NULL;
|
2012-10-21 04:52:43 +00:00
|
|
|
bglBlendEquation = NULL;
|
2006-10-15 18:51:41 +00:00
|
|
|
bglCullFace = NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
bglFrontFace = NULL;
|
|
|
|
bglPolygonOffset = NULL;
|
2006-10-15 18:51:41 +00:00
|
|
|
bglPolygonMode = NULL;
|
|
|
|
bglEnable = NULL;
|
|
|
|
bglDisable = NULL;
|
2007-03-22 18:28:41 +00:00
|
|
|
bglGetDoublev = NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
bglGetFloatv = NULL;
|
|
|
|
bglGetIntegerv = NULL;
|
|
|
|
bglPushAttrib = NULL;
|
|
|
|
bglPopAttrib = NULL;
|
2006-10-15 18:51:41 +00:00
|
|
|
bglGetError = NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
bglGetString = NULL;
|
2006-10-15 18:51:41 +00:00
|
|
|
bglHint = NULL;
|
2007-12-12 17:42:14 +00:00
|
|
|
bglDrawBuffer = NULL;
|
|
|
|
bglReadBuffer = NULL;
|
|
|
|
bglScissor = NULL;
|
2008-04-06 23:35:48 +00:00
|
|
|
bglClipPlane = NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Depth
|
|
|
|
bglDepthFunc = NULL;
|
|
|
|
bglDepthMask = NULL;
|
|
|
|
bglDepthRange = NULL;
|
|
|
|
|
|
|
|
// Matrix
|
|
|
|
bglMatrixMode = NULL;
|
2006-10-15 18:51:41 +00:00
|
|
|
bglOrtho = NULL;
|
|
|
|
bglFrustum = NULL;
|
|
|
|
bglViewport = NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
bglPushMatrix = NULL;
|
|
|
|
bglPopMatrix = NULL;
|
|
|
|
bglLoadIdentity = NULL;
|
|
|
|
bglLoadMatrixf = NULL;
|
2007-03-22 18:28:41 +00:00
|
|
|
bglLoadMatrixd = NULL;
|
2006-10-15 18:51:41 +00:00
|
|
|
bglMultMatrixf = NULL;
|
2007-03-22 18:28:41 +00:00
|
|
|
bglMultMatrixd = NULL;
|
2006-10-15 18:51:41 +00:00
|
|
|
bglRotatef = NULL;
|
|
|
|
bglScalef = NULL;
|
|
|
|
bglTranslatef = NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Drawing
|
|
|
|
bglBegin = NULL;
|
|
|
|
bglEnd = NULL;
|
|
|
|
bglVertex2f = NULL;
|
|
|
|
bglVertex2i = NULL;
|
2006-10-18 03:59:28 +00:00
|
|
|
bglVertex3f = NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
bglVertex3d = NULL;
|
2006-10-15 18:51:41 +00:00
|
|
|
bglVertex3fv = NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
bglColor4f = NULL;
|
|
|
|
bglColor4ub = NULL;
|
2006-10-15 18:51:41 +00:00
|
|
|
bglTexCoord2d = NULL;
|
|
|
|
bglTexCoord2f = NULL;
|
2008-11-05 11:49:13 +00:00
|
|
|
bglTexCoord2i = NULL;
|
2008-11-29 20:16:19 +00:00
|
|
|
bglNormal3f = NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Lighting
|
|
|
|
bglShadeModel = NULL;
|
2009-01-23 10:59:18 +00:00
|
|
|
bglLightfv = NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Raster funcs
|
|
|
|
bglReadPixels = NULL;
|
2008-06-09 02:36:45 +00:00
|
|
|
bglRasterPos4i = NULL;
|
|
|
|
bglDrawPixels = NULL;
|
2012-04-01 04:24:57 +00:00
|
|
|
bglPixelStorei = NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
// Texture mapping
|
2006-10-15 18:51:41 +00:00
|
|
|
bglTexEnvf = NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
bglGenTextures = NULL;
|
|
|
|
bglDeleteTextures = NULL;
|
|
|
|
bglBindTexture = NULL;
|
|
|
|
bglTexImage2D = NULL;
|
2010-12-29 06:23:49 +00:00
|
|
|
bglTexImage3D = NULL;
|
2006-12-31 06:32:04 +00:00
|
|
|
bglCopyTexImage2D = NULL;
|
|
|
|
bglCopyTexSubImage2D= NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
bglTexSubImage2D = NULL;
|
|
|
|
bglTexParameterf = NULL;
|
|
|
|
bglTexParameteri = NULL;
|
2012-04-10 20:14:52 +00:00
|
|
|
bglGetTexParameteriv = NULL;
|
2006-04-24 19:04:22 +00:00
|
|
|
bglGetTexLevelParameteriv = NULL;
|
|
|
|
bglCompressedTexImage2DARB = NULL;
|
|
|
|
bglGetCompressedTexImageARB = NULL;
|
|
|
|
|
|
|
|
// Fog
|
|
|
|
bglFogf = NULL;
|
|
|
|
bglFogi = NULL;
|
|
|
|
bglFogfv = NULL;
|
|
|
|
|
2006-09-27 02:23:27 +00:00
|
|
|
// Display Lists
|
2006-10-15 18:51:41 +00:00
|
|
|
bglNewList = NULL;
|
|
|
|
bglEndList = NULL;
|
|
|
|
bglCallList = NULL;
|
2006-12-31 06:32:04 +00:00
|
|
|
bglDeleteLists = NULL;
|
2006-09-27 02:23:27 +00:00
|
|
|
|
|
|
|
// Vertex Arrays
|
|
|
|
bglEnableClientState = NULL;
|
|
|
|
bglDisableClientState = NULL;
|
|
|
|
bglVertexPointer = NULL;
|
2008-06-06 14:00:12 +00:00
|
|
|
bglNormalPointer = NULL;
|
2006-09-27 02:23:27 +00:00
|
|
|
bglTexCoordPointer = NULL;
|
|
|
|
bglDrawElements = NULL;
|
|
|
|
|
2006-10-04 09:54:25 +00:00
|
|
|
// Stencil Buffer
|
|
|
|
bglClearStencil = NULL;
|
|
|
|
bglStencilOp = NULL;
|
|
|
|
bglStencilFunc = NULL;
|
|
|
|
|
2006-12-31 06:32:04 +00:00
|
|
|
// GPU Programs
|
|
|
|
bglGenProgramsARB = NULL;
|
|
|
|
bglBindProgramARB = NULL;
|
|
|
|
bglProgramStringARB = NULL;
|
2007-01-06 01:29:45 +00:00
|
|
|
bglDeleteProgramsARB= NULL;
|
2006-12-31 06:32:04 +00:00
|
|
|
|
|
|
|
// Multitexturing
|
2007-03-03 23:09:40 +00:00
|
|
|
bglActiveTextureARB = NULL;
|
|
|
|
bglClientActiveTextureARB = NULL;
|
|
|
|
bglMultiTexCoord2dARB = NULL;
|
|
|
|
bglMultiTexCoord2fARB = NULL;
|
2006-12-31 06:32:04 +00:00
|
|
|
|
2007-01-06 01:29:45 +00:00
|
|
|
// Frame Buffer Objects
|
|
|
|
bglGenFramebuffersEXT = NULL;
|
2007-12-12 17:42:14 +00:00
|
|
|
bglBindFramebufferEXT = NULL;
|
|
|
|
bglFramebufferTexture2DEXT = NULL;
|
|
|
|
bglCheckFramebufferStatusEXT = NULL;
|
|
|
|
bglDeleteFramebuffersEXT = NULL;
|
|
|
|
|
|
|
|
// Vertex Buffer Objects
|
|
|
|
bglGenBuffersARB = NULL;
|
|
|
|
bglBindBufferARB = NULL;
|
|
|
|
bglDeleteBuffersARB = NULL;
|
2007-03-08 03:07:10 +00:00
|
|
|
bglBufferDataARB = NULL;
|
2008-05-24 09:37:09 +00:00
|
|
|
bglBufferSubDataARB = NULL;
|
2007-03-08 03:07:10 +00:00
|
|
|
bglMapBufferARB = NULL;
|
|
|
|
bglUnmapBufferARB = NULL;
|
2007-01-06 01:29:45 +00:00
|
|
|
|
2008-11-16 21:46:11 +00:00
|
|
|
// Occlusion queries
|
|
|
|
bglGenQueriesARB = NULL;
|
|
|
|
bglDeleteQueriesARB = NULL;
|
|
|
|
bglIsQueryARB = NULL;
|
|
|
|
bglBeginQueryARB = NULL;
|
|
|
|
bglEndQueryARB = NULL;
|
|
|
|
bglGetQueryivARB = NULL;
|
|
|
|
bglGetQueryObjectivARB = NULL;
|
|
|
|
bglGetQueryObjectuivARB = NULL;
|
|
|
|
|
|
|
|
// Shader Objects
|
|
|
|
bglDeleteObjectARB = NULL;
|
|
|
|
bglGetHandleARB = NULL;
|
|
|
|
bglDetachObjectARB = NULL;
|
|
|
|
bglCreateShaderObjectARB = NULL;
|
|
|
|
bglShaderSourceARB = NULL;
|
|
|
|
bglCompileShaderARB = NULL;
|
|
|
|
bglCreateProgramObjectARB = NULL;
|
|
|
|
bglAttachObjectARB = NULL;
|
|
|
|
bglLinkProgramARB = NULL;
|
|
|
|
bglUseProgramObjectARB = NULL;
|
|
|
|
bglValidateProgramARB = NULL;
|
|
|
|
bglUniform1fARB = NULL;
|
|
|
|
bglUniform2fARB = NULL;
|
|
|
|
bglUniform3fARB = NULL;
|
|
|
|
bglUniform4fARB = NULL;
|
|
|
|
bglUniform1iARB = NULL;
|
|
|
|
bglUniform2iARB = NULL;
|
|
|
|
bglUniform3iARB = NULL;
|
|
|
|
bglUniform4iARB = NULL;
|
|
|
|
bglUniform1fvARB = NULL;
|
|
|
|
bglUniform2fvARB = NULL;
|
|
|
|
bglUniform3fvARB = NULL;
|
|
|
|
bglUniform4fvARB = NULL;
|
|
|
|
bglUniform1ivARB = NULL;
|
|
|
|
bglUniform2ivARB = NULL;
|
|
|
|
bglUniform3ivARB = NULL;
|
|
|
|
bglUniform4ivARB = NULL;
|
|
|
|
bglUniformMatrix2fvARB = NULL;
|
|
|
|
bglUniformMatrix3fvARB = NULL;
|
|
|
|
bglUniformMatrix4fvARB = NULL;
|
|
|
|
bglGetObjectParameterfvARB = NULL;
|
|
|
|
bglGetObjectParameterivARB = NULL;
|
|
|
|
bglGetInfoLogARB = NULL;
|
|
|
|
bglGetAttachedObjectsARB = NULL;
|
|
|
|
bglGetUniformLocationARB = NULL;
|
|
|
|
bglGetActiveUniformARB = NULL;
|
|
|
|
bglGetUniformfvARB = NULL;
|
|
|
|
bglGetUniformivARB = NULL;
|
|
|
|
bglGetShaderSourceARB = NULL;
|
|
|
|
|
2008-11-16 22:56:55 +00:00
|
|
|
// Vertex Shaders
|
|
|
|
bglVertexAttrib1dARB = NULL;
|
|
|
|
bglVertexAttrib1dvARB = NULL;
|
|
|
|
bglVertexAttrib1fARB = NULL;
|
|
|
|
bglVertexAttrib1fvARB = NULL;
|
|
|
|
bglVertexAttrib1sARB = NULL;
|
|
|
|
bglVertexAttrib1svARB = NULL;
|
|
|
|
bglVertexAttrib2dARB = NULL;
|
|
|
|
bglVertexAttrib2dvARB = NULL;
|
|
|
|
bglVertexAttrib2fARB = NULL;
|
|
|
|
bglVertexAttrib2fvARB = NULL;
|
|
|
|
bglVertexAttrib2sARB = NULL;
|
|
|
|
bglVertexAttrib2svARB = NULL;
|
|
|
|
bglVertexAttrib3dARB = NULL;
|
|
|
|
bglVertexAttrib3dvARB = NULL;
|
|
|
|
bglVertexAttrib3fARB = NULL;
|
|
|
|
bglVertexAttrib3fvARB = NULL;
|
|
|
|
bglVertexAttrib3sARB = NULL;
|
|
|
|
bglVertexAttrib3svARB = NULL;
|
|
|
|
bglVertexAttrib4NbvARB = NULL;
|
|
|
|
bglVertexAttrib4NivARB = NULL;
|
|
|
|
bglVertexAttrib4NsvARB = NULL;
|
|
|
|
bglVertexAttrib4NubARB = NULL;
|
|
|
|
bglVertexAttrib4NubvARB = NULL;
|
|
|
|
bglVertexAttrib4NuivARB = NULL;
|
|
|
|
bglVertexAttrib4NusvARB = NULL;
|
|
|
|
bglVertexAttrib4bvARB = NULL;
|
|
|
|
bglVertexAttrib4dARB = NULL;
|
|
|
|
bglVertexAttrib4dvARB = NULL;
|
|
|
|
bglVertexAttrib4fARB = NULL;
|
|
|
|
bglVertexAttrib4fvARB = NULL;
|
|
|
|
bglVertexAttrib4ivARB = NULL;
|
|
|
|
bglVertexAttrib4sARB = NULL;
|
|
|
|
bglVertexAttrib4svARB = NULL;
|
|
|
|
bglVertexAttrib4ubvARB = NULL;
|
|
|
|
bglVertexAttrib4uivARB = NULL;
|
|
|
|
bglVertexAttrib4usvARB = NULL;
|
|
|
|
bglVertexAttribPointerARB = NULL;
|
|
|
|
bglEnableVertexAttribArrayARB = NULL;
|
|
|
|
bglDisableVertexAttribArrayARB = NULL;
|
|
|
|
bglGetVertexAttribdvARB = NULL;
|
|
|
|
bglGetVertexAttribfvARB = NULL;
|
|
|
|
bglGetVertexAttribivARB = NULL;
|
|
|
|
bglGetVertexAttribPointervARB = NULL;
|
|
|
|
bglBindAttribLocationARB = NULL;
|
|
|
|
bglGetActiveAttribARB = NULL;
|
|
|
|
bglGetAttribLocationARB = NULL;
|
|
|
|
|
2006-04-23 06:44:19 +00:00
|
|
|
#ifdef RENDERTYPEWIN
|
2006-04-24 19:04:22 +00:00
|
|
|
bwglCreateContext = NULL;
|
|
|
|
bwglDeleteContext = NULL;
|
|
|
|
bwglGetProcAddress = NULL;
|
|
|
|
bwglMakeCurrent = NULL;
|
|
|
|
|
|
|
|
bwglSwapBuffers = NULL;
|
|
|
|
bwglChoosePixelFormat = NULL;
|
|
|
|
bwglDescribePixelFormat = NULL;
|
|
|
|
bwglGetPixelFormat = NULL;
|
|
|
|
bwglSetPixelFormat = NULL;
|
2008-07-22 21:03:09 +00:00
|
|
|
bwglSwapIntervalEXT = NULL;
|
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
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t loadglulibrary(const char *driver)
|
2007-01-16 03:19:04 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t err=0;
|
2007-01-16 03:19:04 +00:00
|
|
|
|
|
|
|
#ifdef RENDERTYPEWIN
|
|
|
|
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.
|
|
|
|
#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);
|
2010-05-16 22:53:08 +00:00
|
|
|
if (!hGLUDLL) goto fail;
|
2007-01-16 03:19:04 +00:00
|
|
|
#else
|
|
|
|
gluhandle = dlopen(driver, RTLD_NOW|RTLD_GLOBAL);
|
2010-05-16 22:53:08 +00:00
|
|
|
if (!gluhandle) goto fail;
|
2007-01-16 03:19:04 +00:00
|
|
|
#endif
|
2009-10-07 06:47:35 +00:00
|
|
|
glulibrary = Bstrdup(driver);
|
2007-01-16 03:19:04 +00:00
|
|
|
|
|
|
|
bgluTessBeginContour = GLUGETPROC("gluTessBeginContour");
|
|
|
|
bgluTessBeginPolygon = GLUGETPROC("gluTessBeginPolygon");
|
|
|
|
bgluTessCallback = GLUGETPROC("gluTessCallback");
|
|
|
|
bgluTessEndContour = GLUGETPROC("gluTessEndContour");
|
|
|
|
bgluTessEndPolygon = GLUGETPROC("gluTessEndPolygon");
|
|
|
|
bgluTessNormal = GLUGETPROC("gluTessNormal");
|
|
|
|
bgluTessProperty = GLUGETPROC("gluTessProperty");
|
|
|
|
bgluTessVertex = GLUGETPROC("gluTessVertex");
|
|
|
|
bgluNewTess = GLUGETPROC("gluNewTess");
|
2011-07-22 22:00:53 +00:00
|
|
|
bgluDeleteTess = GLUGETPROC("gluDeleteTess");
|
2007-07-01 06:32:03 +00:00
|
|
|
|
2007-01-16 03:19:04 +00:00
|
|
|
bgluPerspective = GLUGETPROC("gluPerspective");
|
2007-07-01 06:32:03 +00:00
|
|
|
|
2007-01-16 03:19:04 +00:00
|
|
|
bgluErrorString = GLUGETPROC("gluErrorString");
|
|
|
|
|
2007-07-01 06:32:03 +00:00
|
|
|
bgluProject = GLUGETPROC("gluProject");
|
2009-07-11 22:20:15 +00:00
|
|
|
bgluUnProject = GLUGETPROC("gluUnProject");
|
2007-07-01 06:32:03 +00:00
|
|
|
|
2007-01-16 03:19:04 +00:00
|
|
|
if (err) unloadglulibrary();
|
|
|
|
return err;
|
2010-05-16 22:53:08 +00:00
|
|
|
|
|
|
|
fail:
|
|
|
|
initprintf("Failed loading \"%s\"\n",driver);
|
|
|
|
return -1;
|
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
|
|
|
{
|
|
|
|
#ifdef RENDERTYPEWIN
|
|
|
|
if (!hGLUDLL) return 0;
|
|
|
|
#endif
|
|
|
|
|
2009-10-07 06:47:35 +00:00
|
|
|
Bfree(glulibrary);
|
2007-01-16 03:19:04 +00:00
|
|
|
glulibrary = NULL;
|
|
|
|
|
|
|
|
#ifdef RENDERTYPEWIN
|
|
|
|
FreeLibrary(hGLUDLL);
|
|
|
|
hGLUDLL = NULL;
|
|
|
|
#else
|
|
|
|
if (gluhandle) dlclose(gluhandle);
|
|
|
|
gluhandle = NULL;
|
|
|
|
#endif
|
|
|
|
|
2007-07-01 06:32:03 +00:00
|
|
|
bgluTessBeginContour = NULL;
|
|
|
|
bgluTessBeginPolygon = NULL;
|
|
|
|
bgluTessCallback = NULL;
|
|
|
|
bgluTessEndContour = NULL;
|
|
|
|
bgluTessEndPolygon = NULL;
|
|
|
|
bgluTessNormal = NULL;
|
|
|
|
bgluTessProperty = NULL;
|
|
|
|
bgluTessVertex = NULL;
|
|
|
|
bgluNewTess = NULL;
|
2011-07-22 22:00:53 +00:00
|
|
|
bgluDeleteTess = NULL;
|
2007-07-01 06:32:03 +00:00
|
|
|
|
|
|
|
bgluPerspective = NULL;
|
|
|
|
|
|
|
|
bgluErrorString = NULL;
|
|
|
|
|
|
|
|
bgluProject = NULL;
|
2009-07-11 22:20:15 +00:00
|
|
|
bgluUnProject = NULL;
|
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);
|
|
|
|
|
|
|
|
texnameused = Brealloc(texnameused, newsize>>3);
|
|
|
|
texnamefromwhere = Brealloc(texnamefromwhere, newsize*sizeof(uint32_t));
|
|
|
|
|
|
|
|
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
|