| 1 | /* |
| 2 | Copyright (C) 1999-2006 Id Software, Inc. and contributors. |
| 3 | For a list of contributors, see the accompanying CONTRIBUTORS file. |
| 4 | |
| 5 | This file is part of GtkRadiant. |
| 6 | |
| 7 | GtkRadiant is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 2 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | GtkRadiant is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with GtkRadiant; if not, write to the Free Software |
| 19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | |
| 23 | #include "qgl.h" |
| 24 | #include "globaldefs.h" |
| 25 | |
| 26 | #include "debugging/debugging.h" |
| 27 | |
| 28 | #include <stdio.h> |
| 29 | #include <stdlib.h> |
| 30 | #include <string.h> |
| 31 | |
| 32 | #if GDEF_OS_WINDOWS |
| 33 | #define WINGDIAPI __declspec( dllimport ) |
| 34 | #define APIENTRY __stdcall |
| 35 | #endif |
| 36 | |
| 37 | #if GDEF_OS_MACOS && !defined( XWINDOWS ) |
| 38 | #include <OpenGL/gl.h> |
| 39 | #else |
| 40 | #include <GL/gl.h> |
| 41 | #endif |
| 42 | |
| 43 | #if GDEF_OS_WINDOWS |
| 44 | #undef WINGDIAPI |
| 45 | #undef APIENTRY |
| 46 | #endif |
| 47 | |
| 48 | #include "igl.h" |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | #if GDEF_OS_WINDOWS |
| 54 | |
| 55 | #include <wtypes.h> |
| 56 | |
| 57 | PROC ( WINAPI * qwglGetProcAddress )( LPCSTR ); |
| 58 | |
| 59 | #elif defined ( XWINDOWS ) |
| 60 | |
| 61 | #include <GL/glx.h> |
| 62 | #include <dlfcn.h> |
| 63 | |
| 64 | Bool ( *qglXQueryExtension )( Display *dpy, int *errorb, int *event ); |
| 65 | void* ( *qglXGetProcAddressARB )( const GLubyte * procName ); |
| 66 | typedef void* ( *glXGetProcAddressARBProc )( const GLubyte *procName ); |
| 67 | |
| 68 | #elif GDEF_OS_MACOS |
| 69 | #include <mach-o/dyld.h> |
| 70 | #include <stdlib.h> |
| 71 | #include <string.h> |
| 72 | #else |
| 73 | #error "unsupported platform" |
| 74 | #endif |
| 75 | |
| 76 | |
| 77 | void QGL_Shutdown( OpenGLBinding& table ){ |
| 78 | globalOutputStream() << "Shutting down OpenGL module..."; |
| 79 | |
| 80 | #if GDEF_OS_WINDOWS |
| 81 | qwglGetProcAddress = 0; |
| 82 | #elif defined( XWINDOWS ) |
| 83 | qglXQueryExtension = glXQueryExtension; |
| 84 | qglXGetProcAddressARB = 0; |
| 85 | #elif GDEF_OS_MACOS |
| 86 | #else |
| 87 | #error "unsupported platform" |
| 88 | #endif |
| 89 | |
| 90 | globalOutputStream() << "Done.\n"; |
| 91 | } |
| 92 | |
| 93 | |
| 94 | typedef struct glu_error_struct |
| 95 | { |
| 96 | GLenum errnum; |
| 97 | const char *errstr; |
| 98 | } GLU_ERROR_STRUCT; |
| 99 | |
| 100 | GLU_ERROR_STRUCT glu_errlist[] = { |
| 101 | {GL_NO_ERROR, "GL_NO_ERROR - no error"}, |
| 102 | {GL_INVALID_ENUM, "GL_INVALID_ENUM - An unacceptable value is specified for an enumerated argument."}, |
| 103 | {GL_INVALID_VALUE, "GL_INVALID_VALUE - A numeric argument is out of range."}, |
| 104 | {GL_INVALID_OPERATION, "GL_INVALID_OPERATION - The specified operation is not allowed in the current state."}, |
| 105 | {GL_STACK_OVERFLOW, "GL_STACK_OVERFLOW - Function would cause a stack overflow."}, |
| 106 | {GL_STACK_UNDERFLOW, "GL_STACK_UNDERFLOW - Function would cause a stack underflow."}, |
| 107 | {GL_OUT_OF_MEMORY, "GL_OUT_OF_MEMORY - There is not enough memory left to execute the function."}, |
| 108 | {0, 0} |
| 109 | }; |
| 110 | |
| 111 | const GLubyte* qgluErrorString( GLenum errCode ){ |
| 112 | int search = 0; |
| 113 | for ( search = 0; glu_errlist[search].errstr; search++ ) |
| 114 | { |
| 115 | if ( errCode == glu_errlist[search].errnum ) { |
| 116 | return (const GLubyte *)glu_errlist[search].errstr; |
| 117 | } |
| 118 | } //end for |
| 119 | return (const GLubyte *)"Unknown error"; |
| 120 | } |
| 121 | |
| 122 | |
| 123 | void glInvalidFunction(){ |
| 124 | ERROR_MESSAGE( "calling an invalid OpenGL function" ); |
| 125 | } |
| 126 | |
| 127 | #define EXTENSIONS_ENABLED 1 |
| 128 | |
| 129 | bool QGL_ExtensionSupported( const char* extension ){ |
| 130 | #if EXTENSIONS_ENABLED |
| 131 | const GLubyte *extensions = 0; |
| 132 | const GLubyte *start; |
| 133 | GLubyte *where, *terminator; |
| 134 | |
| 135 | // Extension names should not have spaces. |
| 136 | where = (GLubyte *) strchr( extension, ' ' ); |
| 137 | if ( where || *extension == '\0' ) { |
| 138 | return false; |
| 139 | } |
| 140 | |
| 141 | extensions = GlobalOpenGL().m_glGetString( GL_EXTENSIONS ); |
| 142 | #if !GDEF_OS_MACOS |
| 143 | if ( !extensions ) { |
| 144 | return false; |
| 145 | } |
| 146 | #endif |
| 147 | |
| 148 | // It takes a bit of care to be fool-proof about parsing the |
| 149 | // OpenGL extensions string. Don't be fooled by sub-strings, etc. |
| 150 | for ( start = extensions; ; ) |
| 151 | { |
| 152 | where = (GLubyte *) strstr( (const char *) start, extension ); |
| 153 | if ( !where ) { |
| 154 | break; |
| 155 | } |
| 156 | |
| 157 | terminator = where + strlen( extension ); |
| 158 | if ( where == start || *( where - 1 ) == ' ' ) { |
| 159 | if ( *terminator == ' ' || *terminator == '\0' ) { |
| 160 | return true; |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | start = terminator; |
| 165 | } |
| 166 | #endif |
| 167 | |
| 168 | return false; |
| 169 | } |
| 170 | |
| 171 | typedef int ( QGL_DLLEXPORT * QGLFunctionPointer )(); |
| 172 | |
| 173 | QGLFunctionPointer QGL_getExtensionFunc( const char* symbol ){ |
| 174 | #if defined( XWINDOWS ) |
| 175 | //ASSERT_NOTNULL(qglXGetProcAddressARB); |
| 176 | if ( qglXGetProcAddressARB == 0 ) { |
| 177 | return reinterpret_cast<QGLFunctionPointer>( glInvalidFunction ); |
| 178 | } |
| 179 | else |
| 180 | { |
| 181 | return (QGLFunctionPointer) qglXGetProcAddressARB( reinterpret_cast<const GLubyte*>( symbol ) ); |
| 182 | } |
| 183 | #elif GDEF_OS_MACOS |
| 184 | // Prepend a '_' for the Unix C symbol mangling convention |
| 185 | char *symbolName = (char *) malloc(strlen(symbol) + 2); |
| 186 | strcpy(symbolName + 1, symbol); |
| 187 | symbolName[0] = '_'; |
| 188 | NSSymbol nssymbol = NULL; |
| 189 | if (NSIsSymbolNameDefined(symbolName)) nssymbol = NSLookupAndBindSymbol(symbolName); |
| 190 | free(symbolName); |
| 191 | return nssymbol ? reinterpret_cast<QGLFunctionPointer>(NSAddressOfSymbol(nssymbol)) : reinterpret_cast<QGLFunctionPointer>(glInvalidFunction); |
| 192 | #elif GDEF_OS_WINDOWS |
| 193 | ASSERT_NOTNULL( qwglGetProcAddress ); |
| 194 | return (QGLFunctionPointer) qwglGetProcAddress( symbol ); |
| 195 | #else |
| 196 | #error "unsupported platform" |
| 197 | #endif |
| 198 | } |
| 199 | |
| 200 | |
| 201 | template<typename Func> |
| 202 | bool QGL_constructExtensionFunc( Func& func, const char* symbol ){ |
| 203 | func = reinterpret_cast<Func>( QGL_getExtensionFunc( symbol ) ); |
| 204 | return func != 0; |
| 205 | } |
| 206 | |
| 207 | template<typename Func> |
| 208 | void QGL_invalidateExtensionFunc( Func& func ){ |
| 209 | func = reinterpret_cast<Func>( glInvalidFunction ); |
| 210 | } |
| 211 | |
| 212 | void QGL_clear( OpenGLBinding& table ){ |
| 213 | QGL_invalidateExtensionFunc( table.m_glAccum ); |
| 214 | QGL_invalidateExtensionFunc( table.m_glAlphaFunc ); |
| 215 | QGL_invalidateExtensionFunc( table.m_glAreTexturesResident ); |
| 216 | QGL_invalidateExtensionFunc( table.m_glArrayElement ); |
| 217 | QGL_invalidateExtensionFunc( table.m_glBegin ); |
| 218 | QGL_invalidateExtensionFunc( table.m_glBindTexture ); |
| 219 | QGL_invalidateExtensionFunc( table.m_glBitmap ); |
| 220 | QGL_invalidateExtensionFunc( table.m_glBlendFunc ); |
| 221 | QGL_invalidateExtensionFunc( table.m_glCallList ); |
| 222 | QGL_invalidateExtensionFunc( table.m_glCallLists ); |
| 223 | QGL_invalidateExtensionFunc( table.m_glClear ); |
| 224 | QGL_invalidateExtensionFunc( table.m_glClearAccum ); |
| 225 | QGL_invalidateExtensionFunc( table.m_glClearColor ); |
| 226 | QGL_invalidateExtensionFunc( table.m_glClearDepth ); |
| 227 | QGL_invalidateExtensionFunc( table.m_glClearIndex ); |
| 228 | QGL_invalidateExtensionFunc( table.m_glClearStencil ); |
| 229 | QGL_invalidateExtensionFunc( table.m_glClipPlane ); |
| 230 | QGL_invalidateExtensionFunc( table.m_glColor3b ); |
| 231 | QGL_invalidateExtensionFunc( table.m_glColor3bv ); |
| 232 | QGL_invalidateExtensionFunc( table.m_glColor3d ); |
| 233 | QGL_invalidateExtensionFunc( table.m_glColor3dv ); |
| 234 | QGL_invalidateExtensionFunc( table.m_glColor3f ); |
| 235 | QGL_invalidateExtensionFunc( table.m_glColor3fv ); |
| 236 | QGL_invalidateExtensionFunc( table.m_glColor3i ); |
| 237 | QGL_invalidateExtensionFunc( table.m_glColor3iv ); |
| 238 | QGL_invalidateExtensionFunc( table.m_glColor3s ); |
| 239 | QGL_invalidateExtensionFunc( table.m_glColor3sv ); |
| 240 | QGL_invalidateExtensionFunc( table.m_glColor3ub ); |
| 241 | QGL_invalidateExtensionFunc( table.m_glColor3ubv ); |
| 242 | QGL_invalidateExtensionFunc( table.m_glColor3ui ); |
| 243 | QGL_invalidateExtensionFunc( table.m_glColor3uiv ); |
| 244 | QGL_invalidateExtensionFunc( table.m_glColor3us ); |
| 245 | QGL_invalidateExtensionFunc( table.m_glColor3usv ); |
| 246 | QGL_invalidateExtensionFunc( table.m_glColor4b ); |
| 247 | QGL_invalidateExtensionFunc( table.m_glColor4bv ); |
| 248 | QGL_invalidateExtensionFunc( table.m_glColor4d ); |
| 249 | QGL_invalidateExtensionFunc( table.m_glColor4dv ); |
| 250 | QGL_invalidateExtensionFunc( table.m_glColor4f ); |
| 251 | QGL_invalidateExtensionFunc( table.m_glColor4fv ); |
| 252 | QGL_invalidateExtensionFunc( table.m_glColor4i ); |
| 253 | QGL_invalidateExtensionFunc( table.m_glColor4iv ); |
| 254 | QGL_invalidateExtensionFunc( table.m_glColor4s ); |
| 255 | QGL_invalidateExtensionFunc( table.m_glColor4sv ); |
| 256 | QGL_invalidateExtensionFunc( table.m_glColor4ub ); |
| 257 | QGL_invalidateExtensionFunc( table.m_glColor4ubv ); |
| 258 | QGL_invalidateExtensionFunc( table.m_glColor4ui ); |
| 259 | QGL_invalidateExtensionFunc( table.m_glColor4uiv ); |
| 260 | QGL_invalidateExtensionFunc( table.m_glColor4us ); |
| 261 | QGL_invalidateExtensionFunc( table.m_glColor4usv ); |
| 262 | QGL_invalidateExtensionFunc( table.m_glColorMask ); |
| 263 | QGL_invalidateExtensionFunc( table.m_glColorMaterial ); |
| 264 | QGL_invalidateExtensionFunc( table.m_glColorPointer ); |
| 265 | QGL_invalidateExtensionFunc( table.m_glCopyPixels ); |
| 266 | QGL_invalidateExtensionFunc( table.m_glCopyTexImage1D ); |
| 267 | QGL_invalidateExtensionFunc( table.m_glCopyTexImage2D ); |
| 268 | QGL_invalidateExtensionFunc( table.m_glCopyTexSubImage1D ); |
| 269 | QGL_invalidateExtensionFunc( table.m_glCopyTexSubImage2D ); |
| 270 | QGL_invalidateExtensionFunc( table.m_glCullFace ); |
| 271 | QGL_invalidateExtensionFunc( table.m_glDeleteLists ); |
| 272 | QGL_invalidateExtensionFunc( table.m_glDeleteTextures ); |
| 273 | QGL_invalidateExtensionFunc( table.m_glDepthFunc ); |
| 274 | QGL_invalidateExtensionFunc( table.m_glDepthMask ); |
| 275 | QGL_invalidateExtensionFunc( table.m_glDepthRange ); |
| 276 | QGL_invalidateExtensionFunc( table.m_glDisable ); |
| 277 | QGL_invalidateExtensionFunc( table.m_glDisableClientState ); |
| 278 | QGL_invalidateExtensionFunc( table.m_glDrawArrays ); |
| 279 | QGL_invalidateExtensionFunc( table.m_glDrawBuffer ); |
| 280 | QGL_invalidateExtensionFunc( table.m_glDrawElements ); |
| 281 | QGL_invalidateExtensionFunc( table.m_glDrawPixels ); |
| 282 | QGL_invalidateExtensionFunc( table.m_glEdgeFlag ); |
| 283 | QGL_invalidateExtensionFunc( table.m_glEdgeFlagPointer ); |
| 284 | QGL_invalidateExtensionFunc( table.m_glEdgeFlagv ); |
| 285 | QGL_invalidateExtensionFunc( table.m_glEnable ); |
| 286 | QGL_invalidateExtensionFunc( table.m_glEnableClientState ); |
| 287 | QGL_invalidateExtensionFunc( table.m_glEnd ); |
| 288 | QGL_invalidateExtensionFunc( table.m_glEndList ); |
| 289 | QGL_invalidateExtensionFunc( table.m_glEvalCoord1d ); |
| 290 | QGL_invalidateExtensionFunc( table.m_glEvalCoord1dv ); |
| 291 | QGL_invalidateExtensionFunc( table.m_glEvalCoord1f ); |
| 292 | QGL_invalidateExtensionFunc( table.m_glEvalCoord1fv ); |
| 293 | QGL_invalidateExtensionFunc( table.m_glEvalCoord2d ); |
| 294 | QGL_invalidateExtensionFunc( table.m_glEvalCoord2dv ); |
| 295 | QGL_invalidateExtensionFunc( table.m_glEvalCoord2f ); |
| 296 | QGL_invalidateExtensionFunc( table.m_glEvalCoord2fv ); |
| 297 | QGL_invalidateExtensionFunc( table.m_glEvalMesh1 ); |
| 298 | QGL_invalidateExtensionFunc( table.m_glEvalMesh2 ); |
| 299 | QGL_invalidateExtensionFunc( table.m_glEvalPoint1 ); |
| 300 | QGL_invalidateExtensionFunc( table.m_glEvalPoint2 ); |
| 301 | QGL_invalidateExtensionFunc( table.m_glFeedbackBuffer ); |
| 302 | QGL_invalidateExtensionFunc( table.m_glFinish ); |
| 303 | QGL_invalidateExtensionFunc( table.m_glFlush ); |
| 304 | QGL_invalidateExtensionFunc( table.m_glFogf ); |
| 305 | QGL_invalidateExtensionFunc( table.m_glFogfv ); |
| 306 | QGL_invalidateExtensionFunc( table.m_glFogi ); |
| 307 | QGL_invalidateExtensionFunc( table.m_glFogiv ); |
| 308 | QGL_invalidateExtensionFunc( table.m_glFrontFace ); |
| 309 | QGL_invalidateExtensionFunc( table.m_glFrustum ); |
| 310 | QGL_invalidateExtensionFunc( table.m_glGenLists ); |
| 311 | QGL_invalidateExtensionFunc( table.m_glGenTextures ); |
| 312 | QGL_invalidateExtensionFunc( table.m_glGetBooleanv ); |
| 313 | QGL_invalidateExtensionFunc( table.m_glGetClipPlane ); |
| 314 | QGL_invalidateExtensionFunc( table.m_glGetDoublev ); |
| 315 | QGL_invalidateExtensionFunc( table.m_glGetError ); |
| 316 | QGL_invalidateExtensionFunc( table.m_glGetFloatv ); |
| 317 | QGL_invalidateExtensionFunc( table.m_glGetIntegerv ); |
| 318 | QGL_invalidateExtensionFunc( table.m_glGetLightfv ); |
| 319 | QGL_invalidateExtensionFunc( table.m_glGetLightiv ); |
| 320 | QGL_invalidateExtensionFunc( table.m_glGetMapdv ); |
| 321 | QGL_invalidateExtensionFunc( table.m_glGetMapfv ); |
| 322 | QGL_invalidateExtensionFunc( table.m_glGetMapiv ); |
| 323 | QGL_invalidateExtensionFunc( table.m_glGetMaterialfv ); |
| 324 | QGL_invalidateExtensionFunc( table.m_glGetMaterialiv ); |
| 325 | QGL_invalidateExtensionFunc( table.m_glGetPixelMapfv ); |
| 326 | QGL_invalidateExtensionFunc( table.m_glGetPixelMapuiv ); |
| 327 | QGL_invalidateExtensionFunc( table.m_glGetPixelMapusv ); |
| 328 | QGL_invalidateExtensionFunc( table.m_glGetPointerv ); |
| 329 | QGL_invalidateExtensionFunc( table.m_glGetPolygonStipple ); |
| 330 | table.m_glGetString = glGetString; |
| 331 | QGL_invalidateExtensionFunc( table.m_glGetTexEnvfv ); |
| 332 | QGL_invalidateExtensionFunc( table.m_glGetTexEnviv ); |
| 333 | QGL_invalidateExtensionFunc( table.m_glGetTexGendv ); |
| 334 | QGL_invalidateExtensionFunc( table.m_glGetTexGenfv ); |
| 335 | QGL_invalidateExtensionFunc( table.m_glGetTexGeniv ); |
| 336 | QGL_invalidateExtensionFunc( table.m_glGetTexImage ); |
| 337 | QGL_invalidateExtensionFunc( table.m_glGetTexLevelParameterfv ); |
| 338 | QGL_invalidateExtensionFunc( table.m_glGetTexLevelParameteriv ); |
| 339 | QGL_invalidateExtensionFunc( table.m_glGetTexParameterfv ); |
| 340 | QGL_invalidateExtensionFunc( table.m_glGetTexParameteriv ); |
| 341 | QGL_invalidateExtensionFunc( table.m_glHint ); |
| 342 | QGL_invalidateExtensionFunc( table.m_glIndexMask ); |
| 343 | QGL_invalidateExtensionFunc( table.m_glIndexPointer ); |
| 344 | QGL_invalidateExtensionFunc( table.m_glIndexd ); |
| 345 | QGL_invalidateExtensionFunc( table.m_glIndexdv ); |
| 346 | QGL_invalidateExtensionFunc( table.m_glIndexf ); |
| 347 | QGL_invalidateExtensionFunc( table.m_glIndexfv ); |
| 348 | QGL_invalidateExtensionFunc( table.m_glIndexi ); |
| 349 | QGL_invalidateExtensionFunc( table.m_glIndexiv ); |
| 350 | QGL_invalidateExtensionFunc( table.m_glIndexs ); |
| 351 | QGL_invalidateExtensionFunc( table.m_glIndexsv ); |
| 352 | QGL_invalidateExtensionFunc( table.m_glIndexub ); |
| 353 | QGL_invalidateExtensionFunc( table.m_glIndexubv ); |
| 354 | QGL_invalidateExtensionFunc( table.m_glInitNames ); |
| 355 | QGL_invalidateExtensionFunc( table.m_glInterleavedArrays ); |
| 356 | QGL_invalidateExtensionFunc( table.m_glIsEnabled ); |
| 357 | QGL_invalidateExtensionFunc( table.m_glIsList ); |
| 358 | QGL_invalidateExtensionFunc( table.m_glIsTexture ); |
| 359 | QGL_invalidateExtensionFunc( table.m_glLightModelf ); |
| 360 | QGL_invalidateExtensionFunc( table.m_glLightModelfv ); |
| 361 | QGL_invalidateExtensionFunc( table.m_glLightModeli ); |
| 362 | QGL_invalidateExtensionFunc( table.m_glLightModeliv ); |
| 363 | QGL_invalidateExtensionFunc( table.m_glLightf ); |
| 364 | QGL_invalidateExtensionFunc( table.m_glLightfv ); |
| 365 | QGL_invalidateExtensionFunc( table.m_glLighti ); |
| 366 | QGL_invalidateExtensionFunc( table.m_glLightiv ); |
| 367 | QGL_invalidateExtensionFunc( table.m_glLineStipple ); |
| 368 | QGL_invalidateExtensionFunc( table.m_glLineWidth ); |
| 369 | QGL_invalidateExtensionFunc( table.m_glListBase ); |
| 370 | QGL_invalidateExtensionFunc( table.m_glLoadIdentity ); |
| 371 | QGL_invalidateExtensionFunc( table.m_glLoadMatrixd ); |
| 372 | QGL_invalidateExtensionFunc( table.m_glLoadMatrixf ); |
| 373 | QGL_invalidateExtensionFunc( table.m_glLoadName ); |
| 374 | QGL_invalidateExtensionFunc( table.m_glLogicOp ); |
| 375 | QGL_invalidateExtensionFunc( table.m_glMap1d ); |
| 376 | QGL_invalidateExtensionFunc( table.m_glMap1f ); |
| 377 | QGL_invalidateExtensionFunc( table.m_glMap2d ); |
| 378 | QGL_invalidateExtensionFunc( table.m_glMap2f ); |
| 379 | QGL_invalidateExtensionFunc( table.m_glMapGrid1d ); |
| 380 | QGL_invalidateExtensionFunc( table.m_glMapGrid1f ); |
| 381 | QGL_invalidateExtensionFunc( table.m_glMapGrid2d ); |
| 382 | QGL_invalidateExtensionFunc( table.m_glMapGrid2f ); |
| 383 | QGL_invalidateExtensionFunc( table.m_glMaterialf ); |
| 384 | QGL_invalidateExtensionFunc( table.m_glMaterialfv ); |
| 385 | QGL_invalidateExtensionFunc( table.m_glMateriali ); |
| 386 | QGL_invalidateExtensionFunc( table.m_glMaterialiv ); |
| 387 | QGL_invalidateExtensionFunc( table.m_glMatrixMode ); |
| 388 | QGL_invalidateExtensionFunc( table.m_glMultMatrixd ); |
| 389 | QGL_invalidateExtensionFunc( table.m_glMultMatrixf ); |
| 390 | QGL_invalidateExtensionFunc( table.m_glNewList ); |
| 391 | QGL_invalidateExtensionFunc( table.m_glNormal3b ); |
| 392 | QGL_invalidateExtensionFunc( table.m_glNormal3bv ); |
| 393 | QGL_invalidateExtensionFunc( table.m_glNormal3d ); |
| 394 | QGL_invalidateExtensionFunc( table.m_glNormal3dv ); |
| 395 | QGL_invalidateExtensionFunc( table.m_glNormal3f ); |
| 396 | QGL_invalidateExtensionFunc( table.m_glNormal3fv ); |
| 397 | QGL_invalidateExtensionFunc( table.m_glNormal3i ); |
| 398 | QGL_invalidateExtensionFunc( table.m_glNormal3iv ); |
| 399 | QGL_invalidateExtensionFunc( table.m_glNormal3s ); |
| 400 | QGL_invalidateExtensionFunc( table.m_glNormal3sv ); |
| 401 | QGL_invalidateExtensionFunc( table.m_glNormalPointer ); |
| 402 | QGL_invalidateExtensionFunc( table.m_glOrtho ); |
| 403 | QGL_invalidateExtensionFunc( table.m_glPassThrough ); |
| 404 | QGL_invalidateExtensionFunc( table.m_glPixelMapfv ); |
| 405 | QGL_invalidateExtensionFunc( table.m_glPixelMapuiv ); |
| 406 | QGL_invalidateExtensionFunc( table.m_glPixelMapusv ); |
| 407 | QGL_invalidateExtensionFunc( table.m_glPixelStoref ); |
| 408 | QGL_invalidateExtensionFunc( table.m_glPixelStorei ); |
| 409 | QGL_invalidateExtensionFunc( table.m_glPixelTransferf ); |
| 410 | QGL_invalidateExtensionFunc( table.m_glPixelTransferi ); |
| 411 | QGL_invalidateExtensionFunc( table.m_glPixelZoom ); |
| 412 | QGL_invalidateExtensionFunc( table.m_glPointSize ); |
| 413 | QGL_invalidateExtensionFunc( table.m_glPolygonMode ); |
| 414 | QGL_invalidateExtensionFunc( table.m_glPolygonOffset ); |
| 415 | QGL_invalidateExtensionFunc( table.m_glPolygonStipple ); |
| 416 | QGL_invalidateExtensionFunc( table.m_glPopAttrib ); |
| 417 | QGL_invalidateExtensionFunc( table.m_glPopClientAttrib ); |
| 418 | QGL_invalidateExtensionFunc( table.m_glPopMatrix ); |
| 419 | QGL_invalidateExtensionFunc( table.m_glPopName ); |
| 420 | QGL_invalidateExtensionFunc( table.m_glPrioritizeTextures ); |
| 421 | QGL_invalidateExtensionFunc( table.m_glPushAttrib ); |
| 422 | QGL_invalidateExtensionFunc( table.m_glPushClientAttrib ); |
| 423 | QGL_invalidateExtensionFunc( table.m_glPushMatrix ); |
| 424 | QGL_invalidateExtensionFunc( table.m_glPushName ); |
| 425 | QGL_invalidateExtensionFunc( table.m_glRasterPos2d ); |
| 426 | QGL_invalidateExtensionFunc( table.m_glRasterPos2dv ); |
| 427 | QGL_invalidateExtensionFunc( table.m_glRasterPos2f ); |
| 428 | QGL_invalidateExtensionFunc( table.m_glRasterPos2fv ); |
| 429 | QGL_invalidateExtensionFunc( table.m_glRasterPos2i ); |
| 430 | QGL_invalidateExtensionFunc( table.m_glRasterPos2iv ); |
| 431 | QGL_invalidateExtensionFunc( table.m_glRasterPos2s ); |
| 432 | QGL_invalidateExtensionFunc( table.m_glRasterPos2sv ); |
| 433 | QGL_invalidateExtensionFunc( table.m_glRasterPos3d ); |
| 434 | QGL_invalidateExtensionFunc( table.m_glRasterPos3dv ); |
| 435 | QGL_invalidateExtensionFunc( table.m_glRasterPos3f ); |
| 436 | QGL_invalidateExtensionFunc( table.m_glRasterPos3fv ); |
| 437 | QGL_invalidateExtensionFunc( table.m_glRasterPos3i ); |
| 438 | QGL_invalidateExtensionFunc( table.m_glRasterPos3iv ); |
| 439 | QGL_invalidateExtensionFunc( table.m_glRasterPos3s ); |
| 440 | QGL_invalidateExtensionFunc( table.m_glRasterPos3sv ); |
| 441 | QGL_invalidateExtensionFunc( table.m_glRasterPos4d ); |
| 442 | QGL_invalidateExtensionFunc( table.m_glRasterPos4dv ); |
| 443 | QGL_invalidateExtensionFunc( table.m_glRasterPos4f ); |
| 444 | QGL_invalidateExtensionFunc( table.m_glRasterPos4fv ); |
| 445 | QGL_invalidateExtensionFunc( table.m_glRasterPos4i ); |
| 446 | QGL_invalidateExtensionFunc( table.m_glRasterPos4iv ); |
| 447 | QGL_invalidateExtensionFunc( table.m_glRasterPos4s ); |
| 448 | QGL_invalidateExtensionFunc( table.m_glRasterPos4sv ); |
| 449 | QGL_invalidateExtensionFunc( table.m_glReadBuffer ); |
| 450 | QGL_invalidateExtensionFunc( table.m_glReadPixels ); |
| 451 | QGL_invalidateExtensionFunc( table.m_glRectd ); |
| 452 | QGL_invalidateExtensionFunc( table.m_glRectdv ); |
| 453 | QGL_invalidateExtensionFunc( table.m_glRectf ); |
| 454 | QGL_invalidateExtensionFunc( table.m_glRectfv ); |
| 455 | QGL_invalidateExtensionFunc( table.m_glRecti ); |
| 456 | QGL_invalidateExtensionFunc( table.m_glRectiv ); |
| 457 | QGL_invalidateExtensionFunc( table.m_glRects ); |
| 458 | QGL_invalidateExtensionFunc( table.m_glRectsv ); |
| 459 | QGL_invalidateExtensionFunc( table.m_glRenderMode ); |
| 460 | QGL_invalidateExtensionFunc( table.m_glRotated ); |
| 461 | QGL_invalidateExtensionFunc( table.m_glRotatef ); |
| 462 | QGL_invalidateExtensionFunc( table.m_glScaled ); |
| 463 | QGL_invalidateExtensionFunc( table.m_glScalef ); |
| 464 | QGL_invalidateExtensionFunc( table.m_glScissor ); |
| 465 | QGL_invalidateExtensionFunc( table.m_glSelectBuffer ); |
| 466 | QGL_invalidateExtensionFunc( table.m_glShadeModel ); |
| 467 | QGL_invalidateExtensionFunc( table.m_glStencilFunc ); |
| 468 | QGL_invalidateExtensionFunc( table.m_glStencilMask ); |
| 469 | QGL_invalidateExtensionFunc( table.m_glStencilOp ); |
| 470 | QGL_invalidateExtensionFunc( table.m_glTexCoord1d ); |
| 471 | QGL_invalidateExtensionFunc( table.m_glTexCoord1dv ); |
| 472 | QGL_invalidateExtensionFunc( table.m_glTexCoord1f ); |
| 473 | QGL_invalidateExtensionFunc( table.m_glTexCoord1fv ); |
| 474 | QGL_invalidateExtensionFunc( table.m_glTexCoord1i ); |
| 475 | QGL_invalidateExtensionFunc( table.m_glTexCoord1iv ); |
| 476 | QGL_invalidateExtensionFunc( table.m_glTexCoord1s ); |
| 477 | QGL_invalidateExtensionFunc( table.m_glTexCoord1sv ); |
| 478 | QGL_invalidateExtensionFunc( table.m_glTexCoord2d ); |
| 479 | QGL_invalidateExtensionFunc( table.m_glTexCoord2dv ); |
| 480 | QGL_invalidateExtensionFunc( table.m_glTexCoord2f ); |
| 481 | QGL_invalidateExtensionFunc( table.m_glTexCoord2fv ); |
| 482 | QGL_invalidateExtensionFunc( table.m_glTexCoord2i ); |
| 483 | QGL_invalidateExtensionFunc( table.m_glTexCoord2iv ); |
| 484 | QGL_invalidateExtensionFunc( table.m_glTexCoord2s ); |
| 485 | QGL_invalidateExtensionFunc( table.m_glTexCoord2sv ); |
| 486 | QGL_invalidateExtensionFunc( table.m_glTexCoord3d ); |
| 487 | QGL_invalidateExtensionFunc( table.m_glTexCoord3dv ); |
| 488 | QGL_invalidateExtensionFunc( table.m_glTexCoord3f ); |
| 489 | QGL_invalidateExtensionFunc( table.m_glTexCoord3fv ); |
| 490 | QGL_invalidateExtensionFunc( table.m_glTexCoord3i ); |
| 491 | QGL_invalidateExtensionFunc( table.m_glTexCoord3iv ); |
| 492 | QGL_invalidateExtensionFunc( table.m_glTexCoord3s ); |
| 493 | QGL_invalidateExtensionFunc( table.m_glTexCoord3sv ); |
| 494 | QGL_invalidateExtensionFunc( table.m_glTexCoord4d ); |
| 495 | QGL_invalidateExtensionFunc( table.m_glTexCoord4dv ); |
| 496 | QGL_invalidateExtensionFunc( table.m_glTexCoord4f ); |
| 497 | QGL_invalidateExtensionFunc( table.m_glTexCoord4fv ); |
| 498 | QGL_invalidateExtensionFunc( table.m_glTexCoord4i ); |
| 499 | QGL_invalidateExtensionFunc( table.m_glTexCoord4iv ); |
| 500 | QGL_invalidateExtensionFunc( table.m_glTexCoord4s ); |
| 501 | QGL_invalidateExtensionFunc( table.m_glTexCoord4sv ); |
| 502 | QGL_invalidateExtensionFunc( table.m_glTexCoordPointer ); |
| 503 | QGL_invalidateExtensionFunc( table.m_glTexEnvf ); |
| 504 | QGL_invalidateExtensionFunc( table.m_glTexEnvfv ); |
| 505 | QGL_invalidateExtensionFunc( table.m_glTexEnvi ); |
| 506 | QGL_invalidateExtensionFunc( table.m_glTexEnviv ); |
| 507 | QGL_invalidateExtensionFunc( table.m_glTexGend ); |
| 508 | QGL_invalidateExtensionFunc( table.m_glTexGendv ); |
| 509 | QGL_invalidateExtensionFunc( table.m_glTexGenf ); |
| 510 | QGL_invalidateExtensionFunc( table.m_glTexGenfv ); |
| 511 | QGL_invalidateExtensionFunc( table.m_glTexGeni ); |
| 512 | QGL_invalidateExtensionFunc( table.m_glTexGeniv ); |
| 513 | QGL_invalidateExtensionFunc( table.m_glTexImage1D ); |
| 514 | QGL_invalidateExtensionFunc( table.m_glTexImage2D ); |
| 515 | QGL_invalidateExtensionFunc( table.m_glTexParameterf ); |
| 516 | QGL_invalidateExtensionFunc( table.m_glTexParameterfv ); |
| 517 | QGL_invalidateExtensionFunc( table.m_glTexParameteri ); |
| 518 | QGL_invalidateExtensionFunc( table.m_glTexParameteriv ); |
| 519 | QGL_invalidateExtensionFunc( table.m_glTexSubImage1D ); |
| 520 | QGL_invalidateExtensionFunc( table.m_glTexSubImage2D ); |
| 521 | QGL_invalidateExtensionFunc( table.m_glTranslated ); |
| 522 | QGL_invalidateExtensionFunc( table.m_glTranslatef ); |
| 523 | QGL_invalidateExtensionFunc( table.m_glVertex2d ); |
| 524 | QGL_invalidateExtensionFunc( table.m_glVertex2dv ); |
| 525 | QGL_invalidateExtensionFunc( table.m_glVertex2f ); |
| 526 | QGL_invalidateExtensionFunc( table.m_glVertex2fv ); |
| 527 | QGL_invalidateExtensionFunc( table.m_glVertex2i ); |
| 528 | QGL_invalidateExtensionFunc( table.m_glVertex2iv ); |
| 529 | QGL_invalidateExtensionFunc( table.m_glVertex2s ); |
| 530 | QGL_invalidateExtensionFunc( table.m_glVertex2sv ); |
| 531 | QGL_invalidateExtensionFunc( table.m_glVertex3d ); |
| 532 | QGL_invalidateExtensionFunc( table.m_glVertex3dv ); |
| 533 | QGL_invalidateExtensionFunc( table.m_glVertex3f ); |
| 534 | QGL_invalidateExtensionFunc( table.m_glVertex3fv ); |
| 535 | QGL_invalidateExtensionFunc( table.m_glVertex3i ); |
| 536 | QGL_invalidateExtensionFunc( table.m_glVertex3iv ); |
| 537 | QGL_invalidateExtensionFunc( table.m_glVertex3s ); |
| 538 | QGL_invalidateExtensionFunc( table.m_glVertex3sv ); |
| 539 | QGL_invalidateExtensionFunc( table.m_glVertex4d ); |
| 540 | QGL_invalidateExtensionFunc( table.m_glVertex4dv ); |
| 541 | QGL_invalidateExtensionFunc( table.m_glVertex4f ); |
| 542 | QGL_invalidateExtensionFunc( table.m_glVertex4fv ); |
| 543 | QGL_invalidateExtensionFunc( table.m_glVertex4i ); |
| 544 | QGL_invalidateExtensionFunc( table.m_glVertex4iv ); |
| 545 | QGL_invalidateExtensionFunc( table.m_glVertex4s ); |
| 546 | QGL_invalidateExtensionFunc( table.m_glVertex4sv ); |
| 547 | QGL_invalidateExtensionFunc( table.m_glVertexPointer ); |
| 548 | QGL_invalidateExtensionFunc( table.m_glViewport ); |
| 549 | } |
| 550 | |
| 551 | int QGL_Init( OpenGLBinding& table ){ |
| 552 | QGL_clear( table ); |
| 553 | |
| 554 | #if GDEF_OS_WINDOWS |
| 555 | qwglGetProcAddress = wglGetProcAddress; |
| 556 | #elif defined( XWINDOWS ) |
| 557 | qglXGetProcAddressARB = (glXGetProcAddressARBProc)dlsym( RTLD_DEFAULT, "glXGetProcAddressARB" ); |
| 558 | if ( ( qglXQueryExtension == 0 ) || ( qglXQueryExtension(XOpenDisplay(nullptr), 0, 0) != True ) ) { |
| 559 | return 0; |
| 560 | } |
| 561 | #elif GDEF_OS_MACOS |
| 562 | #else |
| 563 | #error "unsupported platform" |
| 564 | #endif |
| 565 | |
| 566 | return 1; |
| 567 | } |
| 568 | |
| 569 | int g_qglMajorVersion = 0; |
| 570 | int g_qglMinorVersion = 0; |
| 571 | |
| 572 | // requires a valid gl context |
| 573 | void QGL_InitVersion(){ |
| 574 | #if EXTENSIONS_ENABLED |
| 575 | const std::size_t versionSize = 256; |
| 576 | char version[versionSize]; |
| 577 | strncpy( version, reinterpret_cast<const char*>( GlobalOpenGL().m_glGetString( GL_VERSION ) ), versionSize - 1 ); |
| 578 | version[versionSize - 1] = '\0'; |
| 579 | char* firstDot = strchr( version, '.' ); |
| 580 | ASSERT_NOTNULL( firstDot ); |
| 581 | *firstDot = '\0'; |
| 582 | g_qglMajorVersion = atoi( version ); |
| 583 | char* secondDot = strchr( firstDot + 1, '.' ); |
| 584 | if ( secondDot != 0 ) { |
| 585 | *secondDot = '\0'; |
| 586 | } |
| 587 | g_qglMinorVersion = atoi( firstDot + 1 ); |
| 588 | #else |
| 589 | g_qglMajorVersion = 1; |
| 590 | g_qglMinorVersion = 1; |
| 591 | #endif |
| 592 | } |
| 593 | |
| 594 | |
| 595 | inline void extension_not_implemented( const char* extension ){ |
| 596 | globalErrorStream() << "WARNING: OpenGL driver reports support for " << extension << " but does not implement it\n"; |
| 597 | } |
| 598 | |
| 599 | float g_maxTextureAnisotropy; |
| 600 | |
| 601 | float QGL_maxTextureAnisotropy(){ |
| 602 | return g_maxTextureAnisotropy; |
| 603 | } |
| 604 | |
| 605 | void QGL_sharedContextCreated( OpenGLBinding& table ){ |
| 606 | QGL_InitVersion(); |
| 607 | |
| 608 | table.major_version = g_qglMajorVersion; |
| 609 | table.minor_version = g_qglMinorVersion; |
| 610 | |
| 611 | table.m_glAccum = glAccum; |
| 612 | table.m_glAlphaFunc = glAlphaFunc; |
| 613 | table.m_glAreTexturesResident = glAreTexturesResident; |
| 614 | table.m_glArrayElement = glArrayElement; |
| 615 | table.m_glBegin = glBegin; |
| 616 | table.m_glBindTexture = glBindTexture; |
| 617 | table.m_glBitmap = glBitmap; |
| 618 | table.m_glBlendFunc = glBlendFunc; |
| 619 | table.m_glCallList = glCallList; |
| 620 | table.m_glCallLists = glCallLists; |
| 621 | table.m_glClear = glClear; |
| 622 | table.m_glClearAccum = glClearAccum; |
| 623 | table.m_glClearColor = glClearColor; |
| 624 | table.m_glClearDepth = glClearDepth; |
| 625 | table.m_glClearIndex = glClearIndex; |
| 626 | table.m_glClearStencil = glClearStencil; |
| 627 | table.m_glClipPlane = glClipPlane; |
| 628 | table.m_glColor3b = glColor3b; |
| 629 | table.m_glColor3bv = glColor3bv; |
| 630 | table.m_glColor3d = glColor3d; |
| 631 | table.m_glColor3dv = glColor3dv; |
| 632 | table.m_glColor3f = glColor3f; |
| 633 | table.m_glColor3fv = glColor3fv; |
| 634 | table.m_glColor3i = glColor3i; |
| 635 | table.m_glColor3iv = glColor3iv; |
| 636 | table.m_glColor3s = glColor3s; |
| 637 | table.m_glColor3sv = glColor3sv; |
| 638 | table.m_glColor3ub = glColor3ub; |
| 639 | table.m_glColor3ubv = glColor3ubv; |
| 640 | table.m_glColor3ui = glColor3ui; |
| 641 | table.m_glColor3uiv = glColor3uiv; |
| 642 | table.m_glColor3us = glColor3us; |
| 643 | table.m_glColor3usv = glColor3usv; |
| 644 | table.m_glColor4b = glColor4b; |
| 645 | table.m_glColor4bv = glColor4bv; |
| 646 | table.m_glColor4d = glColor4d; |
| 647 | table.m_glColor4dv = glColor4dv; |
| 648 | table.m_glColor4f = glColor4f; |
| 649 | table.m_glColor4fv = glColor4fv; |
| 650 | table.m_glColor4i = glColor4i; |
| 651 | table.m_glColor4iv = glColor4iv; |
| 652 | table.m_glColor4s = glColor4s; |
| 653 | table.m_glColor4sv = glColor4sv; |
| 654 | table.m_glColor4ub = glColor4ub; |
| 655 | table.m_glColor4ubv = glColor4ubv; |
| 656 | table.m_glColor4ui = glColor4ui; |
| 657 | table.m_glColor4uiv = glColor4uiv; |
| 658 | table.m_glColor4us = glColor4us; |
| 659 | table.m_glColor4usv = glColor4usv; |
| 660 | table.m_glColorMask = glColorMask; |
| 661 | table.m_glColorMaterial = glColorMaterial; |
| 662 | table.m_glColorPointer = glColorPointer; |
| 663 | table.m_glCopyPixels = glCopyPixels; |
| 664 | table.m_glCopyTexImage1D = glCopyTexImage1D; |
| 665 | table.m_glCopyTexImage2D = glCopyTexImage2D; |
| 666 | table.m_glCopyTexSubImage1D = glCopyTexSubImage1D; |
| 667 | table.m_glCopyTexSubImage2D = glCopyTexSubImage2D; |
| 668 | table.m_glCullFace = glCullFace; |
| 669 | table.m_glDeleteLists = glDeleteLists; |
| 670 | table.m_glDeleteTextures = glDeleteTextures; |
| 671 | table.m_glDepthFunc = glDepthFunc; |
| 672 | table.m_glDepthMask = glDepthMask; |
| 673 | table.m_glDepthRange = glDepthRange; |
| 674 | table.m_glDisable = glDisable; |
| 675 | table.m_glDisableClientState = glDisableClientState; |
| 676 | table.m_glDrawArrays = glDrawArrays; |
| 677 | table.m_glDrawBuffer = glDrawBuffer; |
| 678 | table.m_glDrawElements = glDrawElements; |
| 679 | table.m_glDrawPixels = glDrawPixels; |
| 680 | table.m_glEdgeFlag = glEdgeFlag; |
| 681 | table.m_glEdgeFlagPointer = glEdgeFlagPointer; |
| 682 | table.m_glEdgeFlagv = glEdgeFlagv; |
| 683 | table.m_glEnable = glEnable; |
| 684 | table.m_glEnableClientState = glEnableClientState; |
| 685 | table.m_glEnd = glEnd; |
| 686 | table.m_glEndList = glEndList; |
| 687 | table.m_glEvalCoord1d = glEvalCoord1d; |
| 688 | table.m_glEvalCoord1dv = glEvalCoord1dv; |
| 689 | table.m_glEvalCoord1f = glEvalCoord1f; |
| 690 | table.m_glEvalCoord1fv = glEvalCoord1fv; |
| 691 | table.m_glEvalCoord2d = glEvalCoord2d; |
| 692 | table.m_glEvalCoord2dv = glEvalCoord2dv; |
| 693 | table.m_glEvalCoord2f = glEvalCoord2f; |
| 694 | table.m_glEvalCoord2fv = glEvalCoord2fv; |
| 695 | table.m_glEvalMesh1 = glEvalMesh1; |
| 696 | table.m_glEvalMesh2 = glEvalMesh2; |
| 697 | table.m_glEvalPoint1 = glEvalPoint1; |
| 698 | table.m_glEvalPoint2 = glEvalPoint2; |
| 699 | table.m_glFeedbackBuffer = glFeedbackBuffer; |
| 700 | table.m_glFinish = glFinish; |
| 701 | table.m_glFlush = glFlush; |
| 702 | table.m_glFogf = glFogf; |
| 703 | table.m_glFogfv = glFogfv; |
| 704 | table.m_glFogi = glFogi; |
| 705 | table.m_glFogiv = glFogiv; |
| 706 | table.m_glFrontFace = glFrontFace; |
| 707 | table.m_glFrustum = glFrustum; |
| 708 | table.m_glGenLists = glGenLists; |
| 709 | table.m_glGenTextures = glGenTextures; |
| 710 | table.m_glGetBooleanv = glGetBooleanv; |
| 711 | table.m_glGetClipPlane = glGetClipPlane; |
| 712 | table.m_glGetDoublev = glGetDoublev; |
| 713 | table.m_glGetError = glGetError; |
| 714 | table.m_glGetFloatv = glGetFloatv; |
| 715 | table.m_glGetIntegerv = glGetIntegerv; |
| 716 | table.m_glGetLightfv = glGetLightfv; |
| 717 | table.m_glGetLightiv = glGetLightiv; |
| 718 | table.m_glGetMapdv = glGetMapdv; |
| 719 | table.m_glGetMapfv = glGetMapfv; |
| 720 | table.m_glGetMapiv = glGetMapiv; |
| 721 | table.m_glGetMaterialfv = glGetMaterialfv; |
| 722 | table.m_glGetMaterialiv = glGetMaterialiv; |
| 723 | table.m_glGetPixelMapfv = glGetPixelMapfv; |
| 724 | table.m_glGetPixelMapuiv = glGetPixelMapuiv; |
| 725 | table.m_glGetPixelMapusv = glGetPixelMapusv; |
| 726 | table.m_glGetPointerv = glGetPointerv; |
| 727 | table.m_glGetPolygonStipple = glGetPolygonStipple; |
| 728 | table.m_glGetString = glGetString; |
| 729 | table.m_glGetTexEnvfv = glGetTexEnvfv; |
| 730 | table.m_glGetTexEnviv = glGetTexEnviv; |
| 731 | table.m_glGetTexGendv = glGetTexGendv; |
| 732 | table.m_glGetTexGenfv = glGetTexGenfv; |
| 733 | table.m_glGetTexGeniv = glGetTexGeniv; |
| 734 | table.m_glGetTexImage = glGetTexImage; |
| 735 | table.m_glGetTexLevelParameterfv = glGetTexLevelParameterfv; |
| 736 | table.m_glGetTexLevelParameteriv = glGetTexLevelParameteriv; |
| 737 | table.m_glGetTexParameterfv = glGetTexParameterfv; |
| 738 | table.m_glGetTexParameteriv = glGetTexParameteriv; |
| 739 | table.m_glHint = glHint; |
| 740 | table.m_glIndexMask = glIndexMask; |
| 741 | table.m_glIndexPointer = glIndexPointer; |
| 742 | table.m_glIndexd = glIndexd; |
| 743 | table.m_glIndexdv = glIndexdv; |
| 744 | table.m_glIndexf = glIndexf; |
| 745 | table.m_glIndexfv = glIndexfv; |
| 746 | table.m_glIndexi = glIndexi; |
| 747 | table.m_glIndexiv = glIndexiv; |
| 748 | table.m_glIndexs = glIndexs; |
| 749 | table.m_glIndexsv = glIndexsv; |
| 750 | table.m_glIndexub = glIndexub; |
| 751 | table.m_glIndexubv = glIndexubv; |
| 752 | table.m_glInitNames = glInitNames; |
| 753 | table.m_glInterleavedArrays = glInterleavedArrays; |
| 754 | table.m_glIsEnabled = glIsEnabled; |
| 755 | table.m_glIsList = glIsList; |
| 756 | table.m_glIsTexture = glIsTexture; |
| 757 | table.m_glLightModelf = glLightModelf; |
| 758 | table.m_glLightModelfv = glLightModelfv; |
| 759 | table.m_glLightModeli = glLightModeli; |
| 760 | table.m_glLightModeliv = glLightModeliv; |
| 761 | table.m_glLightf = glLightf; |
| 762 | table.m_glLightfv = glLightfv; |
| 763 | table.m_glLighti = glLighti; |
| 764 | table.m_glLightiv = glLightiv; |
| 765 | table.m_glLineStipple = glLineStipple; |
| 766 | table.m_glLineWidth = glLineWidth; |
| 767 | table.m_glListBase = glListBase; |
| 768 | table.m_glLoadIdentity = glLoadIdentity; |
| 769 | table.m_glLoadMatrixd = glLoadMatrixd; |
| 770 | table.m_glLoadMatrixf = glLoadMatrixf; |
| 771 | table.m_glLoadName = glLoadName; |
| 772 | table.m_glLogicOp = glLogicOp; |
| 773 | table.m_glMap1d = glMap1d; |
| 774 | table.m_glMap1f = glMap1f; |
| 775 | table.m_glMap2d = glMap2d; |
| 776 | table.m_glMap2f = glMap2f; |
| 777 | table.m_glMapGrid1d = glMapGrid1d; |
| 778 | table.m_glMapGrid1f = glMapGrid1f; |
| 779 | table.m_glMapGrid2d = glMapGrid2d; |
| 780 | table.m_glMapGrid2f = glMapGrid2f; |
| 781 | table.m_glMaterialf = glMaterialf; |
| 782 | table.m_glMaterialfv = glMaterialfv; |
| 783 | table.m_glMateriali = glMateriali; |
| 784 | table.m_glMaterialiv = glMaterialiv; |
| 785 | table.m_glMatrixMode = glMatrixMode; |
| 786 | table.m_glMultMatrixd = glMultMatrixd; |
| 787 | table.m_glMultMatrixf = glMultMatrixf; |
| 788 | table.m_glNewList = glNewList; |
| 789 | table.m_glNormal3b = glNormal3b; |
| 790 | table.m_glNormal3bv = glNormal3bv; |
| 791 | table.m_glNormal3d = glNormal3d; |
| 792 | table.m_glNormal3dv = glNormal3dv; |
| 793 | table.m_glNormal3f = glNormal3f; |
| 794 | table.m_glNormal3fv = glNormal3fv; |
| 795 | table.m_glNormal3i = glNormal3i; |
| 796 | table.m_glNormal3iv = glNormal3iv; |
| 797 | table.m_glNormal3s = glNormal3s; |
| 798 | table.m_glNormal3sv = glNormal3sv; |
| 799 | table.m_glNormalPointer = glNormalPointer; |
| 800 | table.m_glOrtho = glOrtho; |
| 801 | table.m_glPassThrough = glPassThrough; |
| 802 | table.m_glPixelMapfv = glPixelMapfv; |
| 803 | table.m_glPixelMapuiv = glPixelMapuiv; |
| 804 | table.m_glPixelMapusv = glPixelMapusv; |
| 805 | table.m_glPixelStoref = glPixelStoref; |
| 806 | table.m_glPixelStorei = glPixelStorei; |
| 807 | table.m_glPixelTransferf = glPixelTransferf; |
| 808 | table.m_glPixelTransferi = glPixelTransferi; |
| 809 | table.m_glPixelZoom = glPixelZoom; |
| 810 | table.m_glPointSize = glPointSize; |
| 811 | table.m_glPolygonMode = glPolygonMode; |
| 812 | table.m_glPolygonOffset = glPolygonOffset; |
| 813 | table.m_glPolygonStipple = glPolygonStipple; |
| 814 | table.m_glPopAttrib = glPopAttrib; |
| 815 | table.m_glPopClientAttrib = glPopClientAttrib; |
| 816 | table.m_glPopMatrix = glPopMatrix; |
| 817 | table.m_glPopName = glPopName; |
| 818 | table.m_glPrioritizeTextures = glPrioritizeTextures; |
| 819 | table.m_glPushAttrib = glPushAttrib; |
| 820 | table.m_glPushClientAttrib = glPushClientAttrib; |
| 821 | table.m_glPushMatrix = glPushMatrix; |
| 822 | table.m_glPushName = glPushName; |
| 823 | table.m_glRasterPos2d = glRasterPos2d; |
| 824 | table.m_glRasterPos2dv = glRasterPos2dv; |
| 825 | table.m_glRasterPos2f = glRasterPos2f; |
| 826 | table.m_glRasterPos2fv = glRasterPos2fv; |
| 827 | table.m_glRasterPos2i = glRasterPos2i; |
| 828 | table.m_glRasterPos2iv = glRasterPos2iv; |
| 829 | table.m_glRasterPos2s = glRasterPos2s; |
| 830 | table.m_glRasterPos2sv = glRasterPos2sv; |
| 831 | table.m_glRasterPos3d = glRasterPos3d; |
| 832 | table.m_glRasterPos3dv = glRasterPos3dv; |
| 833 | table.m_glRasterPos3f = glRasterPos3f; |
| 834 | table.m_glRasterPos3fv = glRasterPos3fv; |
| 835 | table.m_glRasterPos3i = glRasterPos3i; |
| 836 | table.m_glRasterPos3iv = glRasterPos3iv; |
| 837 | table.m_glRasterPos3s = glRasterPos3s; |
| 838 | table.m_glRasterPos3sv = glRasterPos3sv; |
| 839 | table.m_glRasterPos4d = glRasterPos4d; |
| 840 | table.m_glRasterPos4dv = glRasterPos4dv; |
| 841 | table.m_glRasterPos4f = glRasterPos4f; |
| 842 | table.m_glRasterPos4fv = glRasterPos4fv; |
| 843 | table.m_glRasterPos4i = glRasterPos4i; |
| 844 | table.m_glRasterPos4iv = glRasterPos4iv; |
| 845 | table.m_glRasterPos4s = glRasterPos4s; |
| 846 | table.m_glRasterPos4sv = glRasterPos4sv; |
| 847 | table.m_glReadBuffer = glReadBuffer; |
| 848 | table.m_glReadPixels = glReadPixels; |
| 849 | table.m_glRectd = glRectd; |
| 850 | table.m_glRectdv = glRectdv; |
| 851 | table.m_glRectf = glRectf; |
| 852 | table.m_glRectfv = glRectfv; |
| 853 | table.m_glRecti = glRecti; |
| 854 | table.m_glRectiv = glRectiv; |
| 855 | table.m_glRects = glRects; |
| 856 | table.m_glRectsv = glRectsv; |
| 857 | table.m_glRenderMode = glRenderMode; |
| 858 | table.m_glRotated = glRotated; |
| 859 | table.m_glRotatef = glRotatef; |
| 860 | table.m_glScaled = glScaled; |
| 861 | table.m_glScalef = glScalef; |
| 862 | table.m_glScissor = glScissor; |
| 863 | table.m_glSelectBuffer = glSelectBuffer; |
| 864 | table.m_glShadeModel = glShadeModel; |
| 865 | table.m_glStencilFunc = glStencilFunc; |
| 866 | table.m_glStencilMask = glStencilMask; |
| 867 | table.m_glStencilOp = glStencilOp; |
| 868 | table.m_glTexCoord1d = glTexCoord1d; |
| 869 | table.m_glTexCoord1dv = glTexCoord1dv; |
| 870 | table.m_glTexCoord1f = glTexCoord1f; |
| 871 | table.m_glTexCoord1fv = glTexCoord1fv; |
| 872 | table.m_glTexCoord1i = glTexCoord1i; |
| 873 | table.m_glTexCoord1iv = glTexCoord1iv; |
| 874 | table.m_glTexCoord1s = glTexCoord1s; |
| 875 | table.m_glTexCoord1sv = glTexCoord1sv; |
| 876 | table.m_glTexCoord2d = glTexCoord2d; |
| 877 | table.m_glTexCoord2dv = glTexCoord2dv; |
| 878 | table.m_glTexCoord2f = glTexCoord2f; |
| 879 | table.m_glTexCoord2fv = glTexCoord2fv; |
| 880 | table.m_glTexCoord2i = glTexCoord2i; |
| 881 | table.m_glTexCoord2iv = glTexCoord2iv; |
| 882 | table.m_glTexCoord2s = glTexCoord2s; |
| 883 | table.m_glTexCoord2sv = glTexCoord2sv; |
| 884 | table.m_glTexCoord3d = glTexCoord3d; |
| 885 | table.m_glTexCoord3dv = glTexCoord3dv; |
| 886 | table.m_glTexCoord3f = glTexCoord3f; |
| 887 | table.m_glTexCoord3fv = glTexCoord3fv; |
| 888 | table.m_glTexCoord3i = glTexCoord3i; |
| 889 | table.m_glTexCoord3iv = glTexCoord3iv; |
| 890 | table.m_glTexCoord3s = glTexCoord3s; |
| 891 | table.m_glTexCoord3sv = glTexCoord3sv; |
| 892 | table.m_glTexCoord4d = glTexCoord4d; |
| 893 | table.m_glTexCoord4dv = glTexCoord4dv; |
| 894 | table.m_glTexCoord4f = glTexCoord4f; |
| 895 | table.m_glTexCoord4fv = glTexCoord4fv; |
| 896 | table.m_glTexCoord4i = glTexCoord4i; |
| 897 | table.m_glTexCoord4iv = glTexCoord4iv; |
| 898 | table.m_glTexCoord4s = glTexCoord4s; |
| 899 | table.m_glTexCoord4sv = glTexCoord4sv; |
| 900 | table.m_glTexCoordPointer = glTexCoordPointer; |
| 901 | table.m_glTexEnvf = glTexEnvf; |
| 902 | table.m_glTexEnvfv = glTexEnvfv; |
| 903 | table.m_glTexEnvi = glTexEnvi; |
| 904 | table.m_glTexEnviv = glTexEnviv; |
| 905 | table.m_glTexGend = glTexGend; |
| 906 | table.m_glTexGendv = glTexGendv; |
| 907 | table.m_glTexGenf = glTexGenf; |
| 908 | table.m_glTexGenfv = glTexGenfv; |
| 909 | table.m_glTexGeni = glTexGeni; |
| 910 | table.m_glTexGeniv = glTexGeniv; |
| 911 | table.m_glTexImage1D = glTexImage1D; |
| 912 | table.m_glTexImage2D = glTexImage2D; |
| 913 | table.m_glTexParameterf = glTexParameterf; |
| 914 | table.m_glTexParameterfv = glTexParameterfv; |
| 915 | table.m_glTexParameteri = glTexParameteri; |
| 916 | table.m_glTexParameteriv = glTexParameteriv; |
| 917 | table.m_glTexSubImage1D = glTexSubImage1D; |
| 918 | table.m_glTexSubImage2D = glTexSubImage2D; |
| 919 | table.m_glTranslated = glTranslated; |
| 920 | table.m_glTranslatef = glTranslatef; |
| 921 | table.m_glVertex2d = glVertex2d; |
| 922 | table.m_glVertex2dv = glVertex2dv; |
| 923 | table.m_glVertex2f = glVertex2f; |
| 924 | table.m_glVertex2fv = glVertex2fv; |
| 925 | table.m_glVertex2i = glVertex2i; |
| 926 | table.m_glVertex2iv = glVertex2iv; |
| 927 | table.m_glVertex2s = glVertex2s; |
| 928 | table.m_glVertex2sv = glVertex2sv; |
| 929 | table.m_glVertex3d = glVertex3d; |
| 930 | table.m_glVertex3dv = glVertex3dv; |
| 931 | table.m_glVertex3f = glVertex3f; |
| 932 | table.m_glVertex3fv = glVertex3fv; |
| 933 | table.m_glVertex3i = glVertex3i; |
| 934 | table.m_glVertex3iv = glVertex3iv; |
| 935 | table.m_glVertex3s = glVertex3s; |
| 936 | table.m_glVertex3sv = glVertex3sv; |
| 937 | table.m_glVertex4d = glVertex4d; |
| 938 | table.m_glVertex4dv = glVertex4dv; |
| 939 | table.m_glVertex4f = glVertex4f; |
| 940 | table.m_glVertex4fv = glVertex4fv; |
| 941 | table.m_glVertex4i = glVertex4i; |
| 942 | table.m_glVertex4iv = glVertex4iv; |
| 943 | table.m_glVertex4s = glVertex4s; |
| 944 | table.m_glVertex4sv = glVertex4sv; |
| 945 | table.m_glVertexPointer = glVertexPointer; |
| 946 | table.m_glViewport = glViewport; |
| 947 | |
| 948 | if ( QGL_ExtensionSupported( "GL_ARB_multitexture" ) ) { |
| 949 | table.support_ARB_multitexture = |
| 950 | QGL_constructExtensionFunc( table.m_glActiveTextureARB, "glActiveTextureARB" ) |
| 951 | && QGL_constructExtensionFunc( table.m_glClientActiveTextureARB, "glClientActiveTextureARB" ) |
| 952 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord1dARB, "glMultiTexCoord1dARB" ) |
| 953 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord1dvARB, "glMultiTexCoord1dvARB" ) |
| 954 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord1fARB, "glMultiTexCoord1fARB" ) |
| 955 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord1fvARB, "glMultiTexCoord1fvARB" ) |
| 956 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord1iARB, "glMultiTexCoord1iARB" ) |
| 957 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord1ivARB, "glMultiTexCoord1ivARB" ) |
| 958 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord1sARB, "glMultiTexCoord1sARB" ) |
| 959 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord1svARB, "glMultiTexCoord1svARB" ) |
| 960 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord2dARB, "glMultiTexCoord2dARB" ) |
| 961 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord2dvARB, "glMultiTexCoord2dvARB" ) |
| 962 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord2fARB, "glMultiTexCoord2fARB" ) |
| 963 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord2fvARB, "glMultiTexCoord2fvARB" ) |
| 964 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord2iARB, "glMultiTexCoord2iARB" ) |
| 965 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord2ivARB, "glMultiTexCoord2ivARB" ) |
| 966 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord2sARB, "glMultiTexCoord2sARB" ) |
| 967 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord2svARB, "glMultiTexCoord2svARB" ) |
| 968 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord3dARB, "glMultiTexCoord3dARB" ) |
| 969 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord3dvARB, "glMultiTexCoord3dvARB" ) |
| 970 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord3fARB, "glMultiTexCoord3fARB" ) |
| 971 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord3fvARB, "glMultiTexCoord3fvARB" ) |
| 972 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord3iARB, "glMultiTexCoord3iARB" ) |
| 973 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord3ivARB, "glMultiTexCoord3ivARB" ) |
| 974 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord3sARB, "glMultiTexCoord3sARB" ) |
| 975 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord3svARB, "glMultiTexCoord3svARB" ) |
| 976 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord4dARB, "glMultiTexCoord4dARB" ) |
| 977 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord4dvARB, "glMultiTexCoord4dvARB" ) |
| 978 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord4fARB, "glMultiTexCoord4fARB" ) |
| 979 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord4fvARB, "glMultiTexCoord4fvARB" ) |
| 980 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord4iARB, "glMultiTexCoord4iARB" ) |
| 981 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord4ivARB, "glMultiTexCoord4ivARB" ) |
| 982 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord4sARB, "glMultiTexCoord4sARB" ) |
| 983 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord4svARB, "glMultiTexCoord4svARB" ); |
| 984 | |
| 985 | if ( !table.support_ARB_multitexture ) { |
| 986 | extension_not_implemented( "GL_ARB_multitexture" ); |
| 987 | } |
| 988 | } |
| 989 | else |
| 990 | { |
| 991 | table.support_ARB_multitexture = false; |
| 992 | } |
| 993 | |
| 994 | if ( QGL_ExtensionSupported( "GL_ARB_texture_compression" ) ) { |
| 995 | table.support_ARB_texture_compression = |
| 996 | QGL_constructExtensionFunc( table.m_glCompressedTexImage3DARB, "glCompressedTexImage3DARB" ) |
| 997 | && QGL_constructExtensionFunc( table.m_glCompressedTexImage2DARB, "glCompressedTexImage2DARB" ) |
| 998 | && QGL_constructExtensionFunc( table.m_glCompressedTexImage1DARB, "glCompressedTexImage1DARB" ) |
| 999 | && QGL_constructExtensionFunc( table.m_glCompressedTexSubImage3DARB, "glCompressedTexSubImage3DARB" ) |
| 1000 | && QGL_constructExtensionFunc( table.m_glCompressedTexSubImage2DARB, "glCompressedTexSubImage2DARB" ) |
| 1001 | && QGL_constructExtensionFunc( table.m_glCompressedTexSubImage1DARB, "glCompressedTexSubImage1DARB" ) |
| 1002 | && QGL_constructExtensionFunc( table.m_glGetCompressedTexImageARB, "glGetCompressedTexImageARB" ); |
| 1003 | |
| 1004 | if ( !table.support_ARB_texture_compression ) { |
| 1005 | extension_not_implemented( "GL_ARB_texture_compression" ); |
| 1006 | } |
| 1007 | } |
| 1008 | else |
| 1009 | { |
| 1010 | table.support_ARB_texture_compression = false; |
| 1011 | } |
| 1012 | |
| 1013 | table.support_EXT_texture_compression_s3tc = QGL_ExtensionSupported( "GL_EXT_texture_compression_s3tc" ); |
| 1014 | |
| 1015 | // GL 1.2 |
| 1016 | if ( table.major_version > 1 || table.minor_version >= 2 ) { |
| 1017 | table.support_GL_1_2 = |
| 1018 | QGL_constructExtensionFunc( table.m_glCopyTexSubImage3D, "glCopyTexSubImage3D" ) |
| 1019 | && QGL_constructExtensionFunc( table.m_glDrawRangeElements, "glDrawRangeElements" ) |
| 1020 | && QGL_constructExtensionFunc( table.m_glTexImage3D, "glTexImage3D" ) |
| 1021 | && QGL_constructExtensionFunc( table.m_glTexSubImage3D, "glTexSubImage3D" ); |
| 1022 | |
| 1023 | if ( !table.support_GL_1_2 ) { |
| 1024 | extension_not_implemented( "GL_VERSION_1_2" ); |
| 1025 | } |
| 1026 | } |
| 1027 | else |
| 1028 | { |
| 1029 | table.support_GL_1_2 = false; |
| 1030 | } |
| 1031 | |
| 1032 | // GL 1.3 |
| 1033 | if ( table.major_version > 1 || table.minor_version >= 3 ) { |
| 1034 | table.support_GL_1_3 = |
| 1035 | QGL_constructExtensionFunc( table.m_glActiveTexture, "glActiveTexture" ) |
| 1036 | && QGL_constructExtensionFunc( table.m_glClientActiveTexture, "glClientActiveTexture" ) |
| 1037 | && QGL_constructExtensionFunc( table.m_glCompressedTexImage1D, "glCompressedTexImage1D" ) |
| 1038 | && QGL_constructExtensionFunc( table.m_glCompressedTexImage2D, "glCompressedTexImage2D" ) |
| 1039 | && QGL_constructExtensionFunc( table.m_glCompressedTexImage3D, "glCompressedTexImage3D" ) |
| 1040 | && QGL_constructExtensionFunc( table.m_glCompressedTexSubImage1D, "glCompressedTexSubImage1D" ) |
| 1041 | && QGL_constructExtensionFunc( table.m_glCompressedTexSubImage2D, "glCompressedTexSubImage2D" ) |
| 1042 | && QGL_constructExtensionFunc( table.m_glCompressedTexSubImage3D, "glCompressedTexSubImage3D" ) |
| 1043 | && QGL_constructExtensionFunc( table.m_glGetCompressedTexImage, "glGetCompressedTexImage" ) |
| 1044 | && QGL_constructExtensionFunc( table.m_glLoadTransposeMatrixd, "glLoadTransposeMatrixd" ) |
| 1045 | && QGL_constructExtensionFunc( table.m_glLoadTransposeMatrixf, "glLoadTransposeMatrixf" ) |
| 1046 | && QGL_constructExtensionFunc( table.m_glMultTransposeMatrixd, "glMultTransposeMatrixd" ) |
| 1047 | && QGL_constructExtensionFunc( table.m_glMultTransposeMatrixf, "glMultTransposeMatrixf" ) |
| 1048 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord1d, "glMultiTexCoord1d" ) |
| 1049 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord1dv, "glMultiTexCoord1dv" ) |
| 1050 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord1f, "glMultiTexCoord1f" ) |
| 1051 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord1fv, "glMultiTexCoord1fv" ) |
| 1052 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord1i, "glMultiTexCoord1i" ) |
| 1053 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord1iv, "glMultiTexCoord1iv" ) |
| 1054 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord1s, "glMultiTexCoord1s" ) |
| 1055 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord1sv, "glMultiTexCoord1sv" ) |
| 1056 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord2d, "glMultiTexCoord2d" ) |
| 1057 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord2dv, "glMultiTexCoord2dv" ) |
| 1058 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord2f, "glMultiTexCoord2f" ) |
| 1059 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord2fv, "glMultiTexCoord2fv" ) |
| 1060 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord2i, "glMultiTexCoord2i" ) |
| 1061 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord2iv, "glMultiTexCoord2iv" ) |
| 1062 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord2s, "glMultiTexCoord2s" ) |
| 1063 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord2sv, "glMultiTexCoord2sv" ) |
| 1064 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord3d, "glMultiTexCoord3d" ) |
| 1065 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord3dv, "glMultiTexCoord3dv" ) |
| 1066 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord3f, "glMultiTexCoord3f" ) |
| 1067 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord3fv, "glMultiTexCoord3fv" ) |
| 1068 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord3i, "glMultiTexCoord3i" ) |
| 1069 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord3iv, "glMultiTexCoord3iv" ) |
| 1070 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord3s, "glMultiTexCoord3s" ) |
| 1071 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord3sv, "glMultiTexCoord3sv" ) |
| 1072 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord4d, "glMultiTexCoord4d" ) |
| 1073 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord4dv, "glMultiTexCoord4dv" ) |
| 1074 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord4f, "glMultiTexCoord4f" ) |
| 1075 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord4fv, "glMultiTexCoord4fv" ) |
| 1076 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord4i, "glMultiTexCoord4i" ) |
| 1077 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord4iv, "glMultiTexCoord4iv" ) |
| 1078 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord4s, "glMultiTexCoord4s" ) |
| 1079 | && QGL_constructExtensionFunc( table.m_glMultiTexCoord4sv, "glMultiTexCoord4sv" ) |
| 1080 | && QGL_constructExtensionFunc( table.m_glSampleCoverage, "glSampleCoverage" ); |
| 1081 | |
| 1082 | if ( !table.support_GL_1_3 ) { |
| 1083 | extension_not_implemented( "GL_VERSION_1_3" ); |
| 1084 | } |
| 1085 | } |
| 1086 | else |
| 1087 | { |
| 1088 | table.support_GL_1_3 = false; |
| 1089 | } |
| 1090 | |
| 1091 | // GL 1.4 |
| 1092 | if ( table.major_version > 1 || table.minor_version >= 4 ) { |
| 1093 | table.support_GL_1_4 = |
| 1094 | QGL_constructExtensionFunc( table.m_glBlendColor, "glBlendColor" ) |
| 1095 | && QGL_constructExtensionFunc( table.m_glBlendEquation, "glBlendEquation" ) |
| 1096 | && QGL_constructExtensionFunc( table.m_glBlendFuncSeparate, "glBlendFuncSeparate" ) |
| 1097 | && QGL_constructExtensionFunc( table.m_glFogCoordPointer, "glFogCoordPointer" ) |
| 1098 | && QGL_constructExtensionFunc( table.m_glFogCoordd, "glFogCoordd" ) |
| 1099 | && QGL_constructExtensionFunc( table.m_glFogCoorddv, "glFogCoorddv" ) |
| 1100 | && QGL_constructExtensionFunc( table.m_glFogCoordf, "glFogCoordf" ) |
| 1101 | && QGL_constructExtensionFunc( table.m_glFogCoordfv, "glFogCoordfv" ) |
| 1102 | && QGL_constructExtensionFunc( table.m_glMultiDrawArrays, "glMultiDrawArrays" ) |
| 1103 | && QGL_constructExtensionFunc( table.m_glMultiDrawElements, "glMultiDrawElements" ) |
| 1104 | && QGL_constructExtensionFunc( table.m_glPointParameterf, "glPointParameterf" ) |
| 1105 | && QGL_constructExtensionFunc( table.m_glPointParameterfv, "glPointParameterfv" ) |
| 1106 | && QGL_constructExtensionFunc( table.m_glSecondaryColor3b, "glSecondaryColor3b" ) |
| 1107 | && QGL_constructExtensionFunc( table.m_glSecondaryColor3bv, "glSecondaryColor3bv" ) |
| 1108 | && QGL_constructExtensionFunc( table.m_glSecondaryColor3d, "glSecondaryColor3d" ) |
| 1109 | && QGL_constructExtensionFunc( table.m_glSecondaryColor3dv, "glSecondaryColor3dv" ) |
| 1110 | && QGL_constructExtensionFunc( table.m_glSecondaryColor3f, "glSecondaryColor3f" ) |
| 1111 | && QGL_constructExtensionFunc( table.m_glSecondaryColor3fv, "glSecondaryColor3fv" ) |
| 1112 | && QGL_constructExtensionFunc( table.m_glSecondaryColor3i, "glSecondaryColor3i" ) |
| 1113 | && QGL_constructExtensionFunc( table.m_glSecondaryColor3iv, "glSecondaryColor3iv" ) |
| 1114 | && QGL_constructExtensionFunc( table.m_glSecondaryColor3s, "glSecondaryColor3s" ) |
| 1115 | && QGL_constructExtensionFunc( table.m_glSecondaryColor3sv, "glSecondaryColor3sv" ) |
| 1116 | && QGL_constructExtensionFunc( table.m_glSecondaryColor3ub, "glSecondaryColor3ub" ) |
| 1117 | && QGL_constructExtensionFunc( table.m_glSecondaryColor3ubv, "glSecondaryColor3ubv" ) |
| 1118 | && QGL_constructExtensionFunc( table.m_glSecondaryColor3ui, "glSecondaryColor3ui" ) |
| 1119 | && QGL_constructExtensionFunc( table.m_glSecondaryColor3uiv, "glSecondaryColor3uiv" ) |
| 1120 | && QGL_constructExtensionFunc( table.m_glSecondaryColor3us, "glSecondaryColor3us" ) |
| 1121 | && QGL_constructExtensionFunc( table.m_glSecondaryColor3usv, "glSecondaryColor3usv" ) |
| 1122 | && QGL_constructExtensionFunc( table.m_glSecondaryColorPointer, "glSecondaryColorPointer" ) |
| 1123 | && QGL_constructExtensionFunc( table.m_glWindowPos2d, "glWindowPos2d" ) |
| 1124 | && QGL_constructExtensionFunc( table.m_glWindowPos2dv, "glWindowPos2dv" ) |
| 1125 | && QGL_constructExtensionFunc( table.m_glWindowPos2f, "glWindowPos2f" ) |
| 1126 | && QGL_constructExtensionFunc( table.m_glWindowPos2fv, "glWindowPos2fv" ) |
| 1127 | && QGL_constructExtensionFunc( table.m_glWindowPos2i, "glWindowPos2i" ) |
| 1128 | && QGL_constructExtensionFunc( table.m_glWindowPos2iv, "glWindowPos2iv" ) |
| 1129 | && QGL_constructExtensionFunc( table.m_glWindowPos2s, "glWindowPos2s" ) |
| 1130 | && QGL_constructExtensionFunc( table.m_glWindowPos2sv, "glWindowPos2sv" ) |
| 1131 | && QGL_constructExtensionFunc( table.m_glWindowPos3d, "glWindowPos3d" ) |
| 1132 | && QGL_constructExtensionFunc( table.m_glWindowPos3dv, "glWindowPos3dv" ) |
| 1133 | && QGL_constructExtensionFunc( table.m_glWindowPos3f, "glWindowPos3f" ) |
| 1134 | && QGL_constructExtensionFunc( table.m_glWindowPos3fv, "glWindowPos3fv" ) |
| 1135 | && QGL_constructExtensionFunc( table.m_glWindowPos3i, "glWindowPos3i" ) |
| 1136 | && QGL_constructExtensionFunc( table.m_glWindowPos3iv, "glWindowPos3iv" ) |
| 1137 | && QGL_constructExtensionFunc( table.m_glWindowPos3s, "glWindowPos3s" ) |
| 1138 | && QGL_constructExtensionFunc( table.m_glWindowPos3sv, "glWindowPos3sv" ); |
| 1139 | |
| 1140 | if ( !table.support_GL_1_4 ) { |
| 1141 | extension_not_implemented( "GL_VERSION_1_4" ); |
| 1142 | } |
| 1143 | } |
| 1144 | else |
| 1145 | { |
| 1146 | table.support_GL_1_4 = false; |
| 1147 | } |
| 1148 | |
| 1149 | // GL 1.5 |
| 1150 | if ( table.major_version > 1 || table.minor_version >= 5 ) { |
| 1151 | table.support_GL_1_5 = |
| 1152 | QGL_constructExtensionFunc( table.m_glBeginQuery, "glBeginQuery" ) |
| 1153 | && QGL_constructExtensionFunc( table.m_glBindBuffer, "glBindBuffer" ) |
| 1154 | && QGL_constructExtensionFunc( table.m_glBufferData, "glBufferData" ) |
| 1155 | && QGL_constructExtensionFunc( table.m_glBufferSubData, "glBufferSubData" ) |
| 1156 | && QGL_constructExtensionFunc( table.m_glDeleteBuffers, "glDeleteBuffers" ) |
| 1157 | && QGL_constructExtensionFunc( table.m_glDeleteQueries, "glDeleteQueries" ) |
| 1158 | && QGL_constructExtensionFunc( table.m_glEndQuery, "glEndQuery" ) |
| 1159 | && QGL_constructExtensionFunc( table.m_glGenBuffers, "glGenBuffers" ) |
| 1160 | && QGL_constructExtensionFunc( table.m_glGenQueries, "glGenQueries" ) |
| 1161 | && QGL_constructExtensionFunc( table.m_glGetBufferParameteriv, "glGetBufferParameteriv" ) |
| 1162 | && QGL_constructExtensionFunc( table.m_glGetBufferPointerv, "glGetBufferPointerv" ) |
| 1163 | && QGL_constructExtensionFunc( table.m_glGetBufferSubData, "glGetBufferSubData" ) |
| 1164 | && QGL_constructExtensionFunc( table.m_glGetQueryObjectiv, "glGetQueryObjectiv" ) |
| 1165 | && QGL_constructExtensionFunc( table.m_glGetQueryObjectuiv, "glGetQueryObjectuiv" ) |
| 1166 | && QGL_constructExtensionFunc( table.m_glGetQueryiv, "glGetQueryiv" ) |
| 1167 | && QGL_constructExtensionFunc( table.m_glIsBuffer, "glIsBuffer" ) |
| 1168 | && QGL_constructExtensionFunc( table.m_glIsQuery, "glIsQuery" ) |
| 1169 | && QGL_constructExtensionFunc( table.m_glMapBuffer, "glMapBuffer" ) |
| 1170 | && QGL_constructExtensionFunc( table.m_glUnmapBuffer, "glUnmapBuffer" ); |
| 1171 | |
| 1172 | if ( !table.support_GL_1_5 ) { |
| 1173 | extension_not_implemented( "GL_VERSION_1_5" ); |
| 1174 | } |
| 1175 | } |
| 1176 | else |
| 1177 | { |
| 1178 | table.support_GL_1_5 = false; |
| 1179 | } |
| 1180 | |
| 1181 | |
| 1182 | if ( QGL_ExtensionSupported( "GL_ARB_vertex_program" ) ) { |
| 1183 | table.support_ARB_vertex_program = |
| 1184 | QGL_constructExtensionFunc( table.m_glVertexAttrib1sARB, "glVertexAttrib1sARB" ) |
| 1185 | && QGL_constructExtensionFunc( table.m_glVertexAttrib1fARB, "glVertexAttrib1fARB" ) |
| 1186 | && QGL_constructExtensionFunc( table.m_glVertexAttrib1dARB, "glVertexAttrib1dARB" ) |
| 1187 | && QGL_constructExtensionFunc( table.m_glVertexAttrib2sARB, "glVertexAttrib2sARB" ) |
| 1188 | && QGL_constructExtensionFunc( table.m_glVertexAttrib2fARB, "glVertexAttrib2fARB" ) |
| 1189 | && QGL_constructExtensionFunc( table.m_glVertexAttrib2dARB, "glVertexAttrib2dARB" ) |
| 1190 | && QGL_constructExtensionFunc( table.m_glVertexAttrib3sARB, "glVertexAttrib3sARB" ) |
| 1191 | && QGL_constructExtensionFunc( table.m_glVertexAttrib3fARB, "glVertexAttrib3fARB" ) |
| 1192 | && QGL_constructExtensionFunc( table.m_glVertexAttrib3dARB, "glVertexAttrib3dARB" ) |
| 1193 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4sARB, "glVertexAttrib4sARB" ) |
| 1194 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4fARB, "glVertexAttrib4fARB" ) |
| 1195 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4dARB, "glVertexAttrib4dARB" ) |
| 1196 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4NubARB, "glVertexAttrib4NubARB" ) |
| 1197 | && QGL_constructExtensionFunc( table.m_glVertexAttrib1svARB, "glVertexAttrib1svARB" ) |
| 1198 | && QGL_constructExtensionFunc( table.m_glVertexAttrib1fvARB, "glVertexAttrib1fvARB" ) |
| 1199 | && QGL_constructExtensionFunc( table.m_glVertexAttrib1dvARB, "glVertexAttrib1dvARB" ) |
| 1200 | && QGL_constructExtensionFunc( table.m_glVertexAttrib2svARB, "glVertexAttrib2svARB" ) |
| 1201 | && QGL_constructExtensionFunc( table.m_glVertexAttrib2fvARB, "glVertexAttrib2fvARB" ) |
| 1202 | && QGL_constructExtensionFunc( table.m_glVertexAttrib2dvARB, "glVertexAttrib2dvARB" ) |
| 1203 | && QGL_constructExtensionFunc( table.m_glVertexAttrib3svARB, "glVertexAttrib3svARB" ) |
| 1204 | && QGL_constructExtensionFunc( table.m_glVertexAttrib3fvARB, "glVertexAttrib3fvARB" ) |
| 1205 | && QGL_constructExtensionFunc( table.m_glVertexAttrib3dvARB, "glVertexAttrib3dvARB" ) |
| 1206 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4bvARB, "glVertexAttrib4bvARB" ) |
| 1207 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4svARB, "glVertexAttrib4svARB" ) |
| 1208 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4ivARB, "glVertexAttrib4ivARB" ) |
| 1209 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4ubvARB, "glVertexAttrib4ubvARB" ) |
| 1210 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4usvARB, "glVertexAttrib4usvARB" ) |
| 1211 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4uivARB, "glVertexAttrib4uivARB" ) |
| 1212 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4fvARB, "glVertexAttrib4fvARB" ) |
| 1213 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4dvARB, "glVertexAttrib4dvARB" ) |
| 1214 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4NbvARB, "glVertexAttrib4NbvARB" ) |
| 1215 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4NsvARB, "glVertexAttrib4NsvARB" ) |
| 1216 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4NivARB, "glVertexAttrib4NivARB" ) |
| 1217 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4NubvARB, "glVertexAttrib4NubvARB" ) |
| 1218 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4NusvARB, "glVertexAttrib4NusvARB" ) |
| 1219 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4NuivARB, "glVertexAttrib4NuivARB" ) |
| 1220 | && QGL_constructExtensionFunc( table.m_glVertexAttribPointerARB, "glVertexAttribPointerARB" ) |
| 1221 | && QGL_constructExtensionFunc( table.m_glEnableVertexAttribArrayARB, "glEnableVertexAttribArrayARB" ) |
| 1222 | && QGL_constructExtensionFunc( table.m_glDisableVertexAttribArrayARB, "glDisableVertexAttribArrayARB" ) |
| 1223 | && QGL_constructExtensionFunc( table.m_glProgramStringARB, "glProgramStringARB" ) |
| 1224 | && QGL_constructExtensionFunc( table.m_glBindProgramARB, "glBindProgramARB" ) |
| 1225 | && QGL_constructExtensionFunc( table.m_glDeleteProgramsARB, "glDeleteProgramsARB" ) |
| 1226 | && QGL_constructExtensionFunc( table.m_glGenProgramsARB, "glGenProgramsARB" ) |
| 1227 | && QGL_constructExtensionFunc( table.m_glProgramEnvParameter4dARB, "glProgramEnvParameter4dARB" ) |
| 1228 | && QGL_constructExtensionFunc( table.m_glProgramEnvParameter4dvARB, "glProgramEnvParameter4dvARB" ) |
| 1229 | && QGL_constructExtensionFunc( table.m_glProgramEnvParameter4fARB, "glProgramEnvParameter4fARB" ) |
| 1230 | && QGL_constructExtensionFunc( table.m_glProgramEnvParameter4fvARB, "glProgramEnvParameter4fvARB" ) |
| 1231 | && QGL_constructExtensionFunc( table.m_glProgramLocalParameter4dARB, "glProgramLocalParameter4dARB" ) |
| 1232 | && QGL_constructExtensionFunc( table.m_glProgramLocalParameter4dvARB, "glProgramLocalParameter4dvARB" ) |
| 1233 | && QGL_constructExtensionFunc( table.m_glProgramLocalParameter4fARB, "glProgramLocalParameter4fARB" ) |
| 1234 | && QGL_constructExtensionFunc( table.m_glProgramLocalParameter4fvARB, "glProgramLocalParameter4fvARB" ) |
| 1235 | && QGL_constructExtensionFunc( table.m_glGetProgramEnvParameterdvARB, "glGetProgramEnvParameterdvARB" ) |
| 1236 | && QGL_constructExtensionFunc( table.m_glGetProgramEnvParameterfvARB, "glGetProgramEnvParameterfvARB" ) |
| 1237 | && QGL_constructExtensionFunc( table.m_glGetProgramLocalParameterdvARB, "glGetProgramLocalParameterdvARB" ) |
| 1238 | && QGL_constructExtensionFunc( table.m_glGetProgramLocalParameterfvARB, "glGetProgramLocalParameterfvARB" ) |
| 1239 | && QGL_constructExtensionFunc( table.m_glGetProgramivARB, "glGetProgramivARB" ) |
| 1240 | && QGL_constructExtensionFunc( table.m_glGetProgramStringARB, "glGetProgramStringARB" ) |
| 1241 | && QGL_constructExtensionFunc( table.m_glGetVertexAttribdvARB, "glGetVertexAttribdvARB" ) |
| 1242 | && QGL_constructExtensionFunc( table.m_glGetVertexAttribfvARB, "glGetVertexAttribfvARB" ) |
| 1243 | && QGL_constructExtensionFunc( table.m_glGetVertexAttribivARB, "glGetVertexAttribivARB" ) |
| 1244 | && QGL_constructExtensionFunc( table.m_glGetVertexAttribPointervARB, "glGetVertexAttribPointervARB" ) |
| 1245 | && QGL_constructExtensionFunc( table.m_glIsProgramARB, "glIsProgramARB" ); |
| 1246 | |
| 1247 | if ( !table.support_ARB_vertex_program ) { |
| 1248 | extension_not_implemented( "GL_ARB_vertex_program" ); |
| 1249 | } |
| 1250 | } |
| 1251 | else |
| 1252 | { |
| 1253 | table.support_ARB_vertex_program = false; |
| 1254 | } |
| 1255 | |
| 1256 | |
| 1257 | table.support_ARB_fragment_program = QGL_ExtensionSupported( "GL_ARB_fragment_program" ); |
| 1258 | |
| 1259 | if ( QGL_ExtensionSupported( "GL_ARB_shader_objects" ) ) { |
| 1260 | table.support_ARB_shader_objects = |
| 1261 | QGL_constructExtensionFunc( table.m_glDeleteObjectARB, "glDeleteObjectARB" ) |
| 1262 | && QGL_constructExtensionFunc( table.m_glGetHandleARB, "glGetHandleARB" ) |
| 1263 | && QGL_constructExtensionFunc( table.m_glDetachObjectARB, "glDetachObjectARB" ) |
| 1264 | && QGL_constructExtensionFunc( table.m_glCreateShaderObjectARB, "glCreateShaderObjectARB" ) |
| 1265 | && QGL_constructExtensionFunc( table.m_glShaderSourceARB, "glShaderSourceARB" ) |
| 1266 | && QGL_constructExtensionFunc( table.m_glCompileShaderARB, "glCompileShaderARB" ) |
| 1267 | && QGL_constructExtensionFunc( table.m_glCreateProgramObjectARB, "glCreateProgramObjectARB" ) |
| 1268 | && QGL_constructExtensionFunc( table.m_glAttachObjectARB, "glAttachObjectARB" ) |
| 1269 | && QGL_constructExtensionFunc( table.m_glLinkProgramARB, "glLinkProgramARB" ) |
| 1270 | && QGL_constructExtensionFunc( table.m_glUseProgramObjectARB, "glUseProgramObjectARB" ) |
| 1271 | && QGL_constructExtensionFunc( table.m_glValidateProgramARB, "glValidateProgramARB" ) |
| 1272 | && QGL_constructExtensionFunc( table.m_glUniform1fARB, "glUniform1fARB" ) |
| 1273 | && QGL_constructExtensionFunc( table.m_glUniform2fARB, "glUniform2fARB" ) |
| 1274 | && QGL_constructExtensionFunc( table.m_glUniform3fARB, "glUniform3fARB" ) |
| 1275 | && QGL_constructExtensionFunc( table.m_glUniform4fARB, "glUniform4fARB" ) |
| 1276 | && QGL_constructExtensionFunc( table.m_glUniform1iARB, "glUniform1iARB" ) |
| 1277 | && QGL_constructExtensionFunc( table.m_glUniform2iARB, "glUniform2iARB" ) |
| 1278 | && QGL_constructExtensionFunc( table.m_glUniform3iARB, "glUniform3iARB" ) |
| 1279 | && QGL_constructExtensionFunc( table.m_glUniform4iARB, "glUniform4iARB" ) |
| 1280 | && QGL_constructExtensionFunc( table.m_glUniform1fvARB, "glUniform1fvARB" ) |
| 1281 | && QGL_constructExtensionFunc( table.m_glUniform2fvARB, "glUniform2fvARB" ) |
| 1282 | && QGL_constructExtensionFunc( table.m_glUniform3fvARB, "glUniform3fvARB" ) |
| 1283 | && QGL_constructExtensionFunc( table.m_glUniform4fvARB, "glUniform4fvARB" ) |
| 1284 | && QGL_constructExtensionFunc( table.m_glUniform1ivARB, "glUniform1ivARB" ) |
| 1285 | && QGL_constructExtensionFunc( table.m_glUniform2ivARB, "glUniform2ivARB" ) |
| 1286 | && QGL_constructExtensionFunc( table.m_glUniform3ivARB, "glUniform3ivARB" ) |
| 1287 | && QGL_constructExtensionFunc( table.m_glUniform4ivARB, "glUniform4ivARB" ) |
| 1288 | && QGL_constructExtensionFunc( table.m_glUniformMatrix2fvARB, "glUniformMatrix2fvARB" ) |
| 1289 | && QGL_constructExtensionFunc( table.m_glUniformMatrix3fvARB, "glUniformMatrix3fvARB" ) |
| 1290 | && QGL_constructExtensionFunc( table.m_glUniformMatrix4fvARB, "glUniformMatrix4fvARB" ) |
| 1291 | && QGL_constructExtensionFunc( table.m_glGetObjectParameterfvARB, "glGetObjectParameterfvARB" ) |
| 1292 | && QGL_constructExtensionFunc( table.m_glGetObjectParameterivARB, "glGetObjectParameterivARB" ) |
| 1293 | && QGL_constructExtensionFunc( table.m_glGetInfoLogARB, "glGetInfoLogARB" ) |
| 1294 | && QGL_constructExtensionFunc( table.m_glGetAttachedObjectsARB, "glGetAttachedObjectsARB" ) |
| 1295 | && QGL_constructExtensionFunc( table.m_glGetUniformLocationARB, "glGetUniformLocationARB" ) |
| 1296 | && QGL_constructExtensionFunc( table.m_glGetActiveUniformARB, "glGetActiveUniformARB" ) |
| 1297 | && QGL_constructExtensionFunc( table.m_glGetUniformfvARB, "glGetUniformfvARB" ) |
| 1298 | && QGL_constructExtensionFunc( table.m_glGetUniformivARB, "glGetUniformivARB" ) |
| 1299 | && QGL_constructExtensionFunc( table.m_glGetShaderSourceARB, "glGetShaderSourceARB" ); |
| 1300 | |
| 1301 | if ( !table.support_ARB_shader_objects ) { |
| 1302 | extension_not_implemented( "GL_ARB_shader_objects" ); |
| 1303 | } |
| 1304 | } |
| 1305 | else |
| 1306 | { |
| 1307 | table.support_ARB_shader_objects = false; |
| 1308 | } |
| 1309 | |
| 1310 | if ( QGL_ExtensionSupported( "GL_ARB_vertex_shader" ) ) { |
| 1311 | table.support_ARB_vertex_shader = |
| 1312 | QGL_constructExtensionFunc( table.m_glVertexAttrib1fARB, "glVertexAttrib1fARB" ) |
| 1313 | && QGL_constructExtensionFunc( table.m_glVertexAttrib1sARB, "glVertexAttrib1sARB" ) |
| 1314 | && QGL_constructExtensionFunc( table.m_glVertexAttrib1dARB, "glVertexAttrib1dARB" ) |
| 1315 | && QGL_constructExtensionFunc( table.m_glVertexAttrib2fARB, "glVertexAttrib2fARB" ) |
| 1316 | && QGL_constructExtensionFunc( table.m_glVertexAttrib2sARB, "glVertexAttrib2sARB" ) |
| 1317 | && QGL_constructExtensionFunc( table.m_glVertexAttrib2dARB, "glVertexAttrib2dARB" ) |
| 1318 | && QGL_constructExtensionFunc( table.m_glVertexAttrib3fARB, "glVertexAttrib3fARB" ) |
| 1319 | && QGL_constructExtensionFunc( table.m_glVertexAttrib3sARB, "glVertexAttrib3sARB" ) |
| 1320 | && QGL_constructExtensionFunc( table.m_glVertexAttrib3dARB, "glVertexAttrib3dARB" ) |
| 1321 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4fARB, "glVertexAttrib4fARB" ) |
| 1322 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4sARB, "glVertexAttrib4sARB" ) |
| 1323 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4dARB, "glVertexAttrib4dARB" ) |
| 1324 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4NubARB, "glVertexAttrib4NubARB" ) |
| 1325 | && QGL_constructExtensionFunc( table.m_glVertexAttrib1fvARB, "glVertexAttrib1fvARB" ) |
| 1326 | && QGL_constructExtensionFunc( table.m_glVertexAttrib1svARB, "glVertexAttrib1svARB" ) |
| 1327 | && QGL_constructExtensionFunc( table.m_glVertexAttrib1dvARB, "glVertexAttrib1dvARB" ) |
| 1328 | && QGL_constructExtensionFunc( table.m_glVertexAttrib2fvARB, "glVertexAttrib2fvARB" ) |
| 1329 | && QGL_constructExtensionFunc( table.m_glVertexAttrib2svARB, "glVertexAttrib2svARB" ) |
| 1330 | && QGL_constructExtensionFunc( table.m_glVertexAttrib2dvARB, "glVertexAttrib2dvARB" ) |
| 1331 | && QGL_constructExtensionFunc( table.m_glVertexAttrib3fvARB, "glVertexAttrib3fvARB" ) |
| 1332 | && QGL_constructExtensionFunc( table.m_glVertexAttrib3svARB, "glVertexAttrib3svARB" ) |
| 1333 | && QGL_constructExtensionFunc( table.m_glVertexAttrib3dvARB, "glVertexAttrib3dvARB" ) |
| 1334 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4fvARB, "glVertexAttrib4fvARB" ) |
| 1335 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4svARB, "glVertexAttrib4svARB" ) |
| 1336 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4dvARB, "glVertexAttrib4dvARB" ) |
| 1337 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4ivARB, "glVertexAttrib4ivARB" ) |
| 1338 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4bvARB, "glVertexAttrib4bvARB" ) |
| 1339 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4ubvARB, "glVertexAttrib4ubvARB" ) |
| 1340 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4usvARB, "glVertexAttrib4usvARB" ) |
| 1341 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4uivARB, "glVertexAttrib4uivARB" ) |
| 1342 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4NbvARB, "glVertexAttrib4NbvARB" ) |
| 1343 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4NsvARB, "glVertexAttrib4NsvARB" ) |
| 1344 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4NivARB, "glVertexAttrib4NivARB" ) |
| 1345 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4NubvARB, "glVertexAttrib4NubvARB" ) |
| 1346 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4NusvARB, "glVertexAttrib4NusvARB" ) |
| 1347 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4NuivARB, "glVertexAttrib4NuivARB" ) |
| 1348 | && QGL_constructExtensionFunc( table.m_glVertexAttribPointerARB, "glVertexAttribPointerARB" ) |
| 1349 | && QGL_constructExtensionFunc( table.m_glEnableVertexAttribArrayARB, "glEnableVertexAttribArrayARB" ) |
| 1350 | && QGL_constructExtensionFunc( table.m_glDisableVertexAttribArrayARB, "glDisableVertexAttribArrayARB" ) |
| 1351 | && QGL_constructExtensionFunc( table.m_glGetVertexAttribdvARB, "glGetVertexAttribdvARB" ) |
| 1352 | && QGL_constructExtensionFunc( table.m_glGetVertexAttribfvARB, "glGetVertexAttribfvARB" ) |
| 1353 | && QGL_constructExtensionFunc( table.m_glGetVertexAttribivARB, "glGetVertexAttribivARB" ) |
| 1354 | && QGL_constructExtensionFunc( table.m_glGetVertexAttribPointervARB, "glGetVertexAttribPointervARB" ) |
| 1355 | && QGL_constructExtensionFunc( table.m_glBindAttribLocationARB, "glBindAttribLocationARB" ) |
| 1356 | && QGL_constructExtensionFunc( table.m_glGetActiveAttribARB, "glGetActiveAttribARB" ) |
| 1357 | && QGL_constructExtensionFunc( table.m_glGetAttribLocationARB, "glGetAttribLocationARB" ); |
| 1358 | |
| 1359 | if ( !table.support_ARB_vertex_shader ) { |
| 1360 | extension_not_implemented( "GL_ARB_vertex_shader" ); |
| 1361 | } |
| 1362 | } |
| 1363 | else |
| 1364 | { |
| 1365 | table.support_ARB_vertex_shader = false; |
| 1366 | } |
| 1367 | |
| 1368 | if ( QGL_ExtensionSupported( "GL_NV_vertex_program2" ) ) { |
| 1369 | table.support_NV_vertex_program2 = |
| 1370 | QGL_constructExtensionFunc( table.m_glAreProgramsResidentNV, "glAreProgramsResidentNV" ) |
| 1371 | && QGL_constructExtensionFunc( table.m_glBindProgramNV, "glBindProgramNV" ) |
| 1372 | && QGL_constructExtensionFunc( table.m_glDeleteProgramsNV, "glDeleteProgramsNV" ) |
| 1373 | && QGL_constructExtensionFunc( table.m_glExecuteProgramNV, "glExecuteProgramNV" ) |
| 1374 | && QGL_constructExtensionFunc( table.m_glGenProgramsNV, "glGenProgramsNV" ) |
| 1375 | && QGL_constructExtensionFunc( table.m_glGetProgramParameterdvNV, "glGetProgramParameterdvNV" ) |
| 1376 | && QGL_constructExtensionFunc( table.m_glGetProgramParameterfvNV, "glGetProgramParameterfvNV" ) |
| 1377 | && QGL_constructExtensionFunc( table.m_glGetProgramivNV, "glGetProgramivNV" ) |
| 1378 | && QGL_constructExtensionFunc( table.m_glGetProgramStringNV, "glGetProgramStringNV" ) |
| 1379 | && QGL_constructExtensionFunc( table.m_glGetTrackMatrixivNV, "glGetTrackMatrixivNV" ) |
| 1380 | && QGL_constructExtensionFunc( table.m_glGetVertexAttribdvNV, "glGetVertexAttribdvNV" ) |
| 1381 | && QGL_constructExtensionFunc( table.m_glGetVertexAttribfvNV, "glGetVertexAttribfvNV" ) |
| 1382 | && QGL_constructExtensionFunc( table.m_glGetVertexAttribivNV, "glGetVertexAttribivNV" ) |
| 1383 | && QGL_constructExtensionFunc( table.m_glGetVertexAttribPointervNV, "glGetVertexAttribPointervNV" ) |
| 1384 | && QGL_constructExtensionFunc( table.m_glIsProgramNV, "glIsProgramNV" ) |
| 1385 | && QGL_constructExtensionFunc( table.m_glLoadProgramNV, "glLoadProgramNV" ) |
| 1386 | && QGL_constructExtensionFunc( table.m_glProgramParameter4fNV, "glProgramParameter4fNV" ) |
| 1387 | && QGL_constructExtensionFunc( table.m_glProgramParameter4fvNV, "glProgramParameter4fvNV" ) |
| 1388 | && QGL_constructExtensionFunc( table.m_glProgramParameters4fvNV, "glProgramParameters4fvNV" ) |
| 1389 | && QGL_constructExtensionFunc( table.m_glRequestResidentProgramsNV, "glRequestResidentProgramsNV" ) |
| 1390 | && QGL_constructExtensionFunc( table.m_glTrackMatrixNV, "glTrackMatrixNV" ) |
| 1391 | && QGL_constructExtensionFunc( table.m_glVertexAttribPointerNV, "glVertexAttribPointerNV" ) |
| 1392 | && QGL_constructExtensionFunc( table.m_glVertexAttrib1fNV, "glVertexAttrib1fNV" ) |
| 1393 | && QGL_constructExtensionFunc( table.m_glVertexAttrib1fvNV, "glVertexAttrib1fvNV" ) |
| 1394 | && QGL_constructExtensionFunc( table.m_glVertexAttrib2fNV, "glVertexAttrib2fNV" ) |
| 1395 | && QGL_constructExtensionFunc( table.m_glVertexAttrib2fvNV, "glVertexAttrib2fvNV" ) |
| 1396 | && QGL_constructExtensionFunc( table.m_glVertexAttrib3fNV, "glVertexAttrib3fNV" ) |
| 1397 | && QGL_constructExtensionFunc( table.m_glVertexAttrib3fvNV, "glVertexAttrib3fvNV" ) |
| 1398 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4fNV, "glVertexAttrib4fNV" ) |
| 1399 | && QGL_constructExtensionFunc( table.m_glVertexAttrib4fvNV, "glVertexAttrib4fvNV" ) |
| 1400 | && QGL_constructExtensionFunc( table.m_glVertexAttribs1fvNV, "glVertexAttribs1fvNV" ) |
| 1401 | && QGL_constructExtensionFunc( table.m_glVertexAttribs2fvNV, "glVertexAttribs2fvNV" ) |
| 1402 | && QGL_constructExtensionFunc( table.m_glVertexAttribs3fvNV, "glVertexAttribs3fvNV" ) |
| 1403 | && QGL_constructExtensionFunc( table.m_glVertexAttribs4fvNV, "glVertexAttribs4fvNV" ); |
| 1404 | |
| 1405 | if ( !table.support_NV_vertex_program2 ) { |
| 1406 | extension_not_implemented( "GL_NV_vertex_program2" ); |
| 1407 | } |
| 1408 | } |
| 1409 | else |
| 1410 | { |
| 1411 | table.support_NV_vertex_program2 = false; |
| 1412 | QGL_invalidateExtensionFunc( table.m_glAreProgramsResidentNV ); |
| 1413 | QGL_invalidateExtensionFunc( table.m_glBindProgramNV ); |
| 1414 | QGL_invalidateExtensionFunc( table.m_glDeleteProgramsNV ); |
| 1415 | QGL_invalidateExtensionFunc( table.m_glExecuteProgramNV ); |
| 1416 | QGL_invalidateExtensionFunc( table.m_glGenProgramsNV ); |
| 1417 | QGL_invalidateExtensionFunc( table.m_glGetProgramParameterdvNV ); |
| 1418 | QGL_invalidateExtensionFunc( table.m_glGetProgramParameterfvNV ); |
| 1419 | QGL_invalidateExtensionFunc( table.m_glGetProgramivNV ); |
| 1420 | QGL_invalidateExtensionFunc( table.m_glGetProgramStringNV ); |
| 1421 | QGL_invalidateExtensionFunc( table.m_glGetTrackMatrixivNV ); |
| 1422 | QGL_invalidateExtensionFunc( table.m_glGetVertexAttribdvNV ); |
| 1423 | QGL_invalidateExtensionFunc( table.m_glGetVertexAttribfvNV ); |
| 1424 | QGL_invalidateExtensionFunc( table.m_glGetVertexAttribivNV ); |
| 1425 | QGL_invalidateExtensionFunc( table.m_glGetVertexAttribPointervNV ); |
| 1426 | QGL_invalidateExtensionFunc( table.m_glIsProgramNV ); |
| 1427 | QGL_invalidateExtensionFunc( table.m_glLoadProgramNV ); |
| 1428 | QGL_invalidateExtensionFunc( table.m_glProgramParameter4fNV ); |
| 1429 | QGL_invalidateExtensionFunc( table.m_glProgramParameter4fvNV ); |
| 1430 | QGL_invalidateExtensionFunc( table.m_glProgramParameters4fvNV ); |
| 1431 | QGL_invalidateExtensionFunc( table.m_glRequestResidentProgramsNV ); |
| 1432 | QGL_invalidateExtensionFunc( table.m_glTrackMatrixNV ); |
| 1433 | QGL_invalidateExtensionFunc( table.m_glVertexAttribPointerNV ); |
| 1434 | QGL_invalidateExtensionFunc( table.m_glVertexAttrib1fNV ); |
| 1435 | QGL_invalidateExtensionFunc( table.m_glVertexAttrib1fvNV ); |
| 1436 | QGL_invalidateExtensionFunc( table.m_glVertexAttrib2fNV ); |
| 1437 | QGL_invalidateExtensionFunc( table.m_glVertexAttrib2fvNV ); |
| 1438 | QGL_invalidateExtensionFunc( table.m_glVertexAttrib3fNV ); |
| 1439 | QGL_invalidateExtensionFunc( table.m_glVertexAttrib3fvNV ); |
| 1440 | QGL_invalidateExtensionFunc( table.m_glVertexAttrib4fNV ); |
| 1441 | QGL_invalidateExtensionFunc( table.m_glVertexAttrib4fvNV ); |
| 1442 | QGL_invalidateExtensionFunc( table.m_glVertexAttribs1fvNV ); |
| 1443 | QGL_invalidateExtensionFunc( table.m_glVertexAttribs2fvNV ); |
| 1444 | QGL_invalidateExtensionFunc( table.m_glVertexAttribs3fvNV ); |
| 1445 | QGL_invalidateExtensionFunc( table.m_glVertexAttribs4fvNV ); |
| 1446 | } |
| 1447 | |
| 1448 | if ( QGL_ExtensionSupported( "GL_NV_fragment_program" ) ) { |
| 1449 | table.support_NV_fragment_program = |
| 1450 | QGL_constructExtensionFunc( table.m_glProgramNamedParameter4fNV, "glProgramNamedParameter4fNV" ) |
| 1451 | && QGL_constructExtensionFunc( table.m_glProgramNamedParameter4fvNV, "glProgramNamedParameter4fvNV" ) |
| 1452 | && QGL_constructExtensionFunc( table.m_glGetProgramNamedParameterfvNV, "glGetProgramNamedParameterfvNV" ); |
| 1453 | |
| 1454 | if ( !table.support_NV_fragment_program ) { |
| 1455 | extension_not_implemented( "GL_NV_fragment_program" ); |
| 1456 | } |
| 1457 | } |
| 1458 | else |
| 1459 | { |
| 1460 | table.support_NV_fragment_program = false; |
| 1461 | } |
| 1462 | |
| 1463 | table.support_ARB_fragment_shader = QGL_ExtensionSupported( "GL_ARB_fragment_shader" ); |
| 1464 | table.support_ARB_shading_language_100 = QGL_ExtensionSupported( "GL_ARB_shading_language_100" ); |
| 1465 | |
| 1466 | if ( QGL_ExtensionSupported( "GL_EXT_texture_filter_anisotropic" ) ) { |
| 1467 | glGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &g_maxTextureAnisotropy ); |
| 1468 | globalOutputStream() << "Anisotropic filtering possible (max " << g_maxTextureAnisotropy << "x)\n"; |
| 1469 | } |
| 1470 | else |
| 1471 | { |
| 1472 | globalOutputStream() << "No Anisotropic filtering available\n"; |
| 1473 | g_maxTextureAnisotropy = 0; |
| 1474 | } |
| 1475 | } |
| 1476 | |
| 1477 | void QGL_sharedContextDestroyed( OpenGLBinding& table ){ |
| 1478 | QGL_clear( table ); |
| 1479 | } |
| 1480 | |
| 1481 | |
| 1482 | void QGL_assertNoErrors( const char *file, int line ){ |
| 1483 | GLenum error = GlobalOpenGL().m_glGetError(); |
| 1484 | while ( error != GL_NO_ERROR ) |
| 1485 | { |
| 1486 | const char* errorString = reinterpret_cast<const char*>( qgluErrorString( error ) ); |
| 1487 | if ( error == GL_OUT_OF_MEMORY ) { |
| 1488 | ERROR_MESSAGE( "OpenGL out of memory error at " << file << ":" << line << ": " << errorString ); |
| 1489 | } |
| 1490 | else |
| 1491 | { |
| 1492 | ERROR_MESSAGE( "OpenGL error at " << file << ":" << line << ": " << errorString ); |
| 1493 | } |
| 1494 | error = GlobalOpenGL().m_glGetError(); |
| 1495 | } |
| 1496 | } |
| 1497 | |
| 1498 | |
| 1499 | class QglAPI |
| 1500 | { |
| 1501 | OpenGLBinding m_qgl; |
| 1502 | public: |
| 1503 | typedef OpenGLBinding Type; |
| 1504 | STRING_CONSTANT( Name, "*" ); |
| 1505 | |
| 1506 | QglAPI(){ |
| 1507 | QGL_Init( m_qgl ); |
| 1508 | |
| 1509 | m_qgl.assertNoErrors = &QGL_assertNoErrors; |
| 1510 | } |
| 1511 | ~QglAPI(){ |
| 1512 | QGL_Shutdown( m_qgl ); |
| 1513 | } |
| 1514 | OpenGLBinding* getTable(){ |
| 1515 | return &m_qgl; |
| 1516 | } |
| 1517 | }; |
| 1518 | |
| 1519 | #include "modulesystem/singletonmodule.h" |
| 1520 | #include "modulesystem/moduleregistry.h" |
| 1521 | |
| 1522 | typedef SingletonModule<QglAPI> QglModule; |
| 1523 | typedef Static<QglModule> StaticQglModule; |
| 1524 | StaticRegisterModule staticRegisterQgl( StaticQglModule::instance() ); |