mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-28 08:41:55 +00:00
Merge branch 'master' into subset
This commit is contained in:
commit
1c243a55d7
@ -46,18 +46,18 @@ if (@ARGV)
|
||||
|
||||
if (length($extstring))
|
||||
{
|
||||
print " CONST_CAST(" . $extvar . ") = _glewSearchExtension(\"$extstring\", extStart, extEnd);\n";
|
||||
print " " . $extvar . " = _glewSearchExtension(\"$extstring\", extStart, extEnd);\n";
|
||||
}
|
||||
|
||||
if (keys %$functions)
|
||||
{
|
||||
if ($extname =~ /WGL_.*/)
|
||||
{
|
||||
print " if (glewExperimental || " . $extvar . "|| crippled) CONST_CAST(" . $extvar . ")= !_glewInit_$extname(GLEW_CONTEXT_ARG_VAR_INIT);\n";
|
||||
print " if (glewExperimental || " . $extvar . "|| crippled) " . $extvar . "= !_glewInit_$extname(GLEW_CONTEXT_ARG_VAR_INIT);\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print " if (glewExperimental || " . $extvar . ") CONST_CAST(" . $extvar . ") = !_glewInit_$extname(GLEW_CONTEXT_ARG_VAR_INIT);\n";
|
||||
print " if (glewExperimental || " . $extvar . ") " . $extvar . " = !_glewInit_$extname(GLEW_CONTEXT_ARG_VAR_INIT);\n";
|
||||
}
|
||||
}
|
||||
print "#endif /* $extname */\n";
|
||||
|
@ -6,6 +6,8 @@
|
||||
# include <GL/glxew.h>
|
||||
#endif
|
||||
|
||||
#include <stddef.h> /* For size_t */
|
||||
|
||||
/*
|
||||
* Define glewGetContext and related helper macros.
|
||||
*/
|
||||
@ -152,9 +154,33 @@ void* NSGLGetProcAddress (const GLubyte *name)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define GLboolean const cast.
|
||||
* Redefine GLEW_GET_VAR etc without const cast
|
||||
*/
|
||||
#define CONST_CAST(x) (*(GLboolean*)&x)
|
||||
|
||||
#undef GLEW_GET_VAR
|
||||
#ifdef GLEW_MX
|
||||
# define GLEW_GET_VAR(x) (glewGetContext()->x)
|
||||
#else /* GLEW_MX */
|
||||
# define GLEW_GET_VAR(x) (x)
|
||||
#endif /* GLEW_MX */
|
||||
|
||||
#ifdef WGLEW_GET_VAR
|
||||
# undef WGLEW_GET_VAR
|
||||
# ifdef GLEW_MX
|
||||
# define WGLEW_GET_VAR(x) (wglewGetContext()->x)
|
||||
# else /* GLEW_MX */
|
||||
# define WGLEW_GET_VAR(x) (x)
|
||||
# endif /* GLEW_MX */
|
||||
#endif /* WGLEW_GET_VAR */
|
||||
|
||||
#ifdef GLXEW_GET_VAR
|
||||
# undef GLXEW_GET_VAR
|
||||
# ifdef GLEW_MX
|
||||
# define GLXEW_GET_VAR(x) (glxewGetContext()->x)
|
||||
# else /* GLEW_MX */
|
||||
# define GLXEW_GET_VAR(x) (x)
|
||||
# endif /* GLEW_MX */
|
||||
#endif /* GLXEW_GET_VAR */
|
||||
|
||||
/*
|
||||
* GLEW, just like OpenGL or GLU, does not rely on the standard C library.
|
||||
|
@ -44,23 +44,23 @@ GLenum GLEWAPIENTRY glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST)
|
||||
}
|
||||
else
|
||||
{
|
||||
CONST_CAST(GLEW_VERSION_4_4) = ( major > 4 ) || ( major == 4 && minor >= 4 ) ? GL_TRUE : GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_4_3) = GLEW_VERSION_4_4 == GL_TRUE || ( major == 4 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_4_2) = GLEW_VERSION_4_3 == GL_TRUE || ( major == 4 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_4_1) = GLEW_VERSION_4_2 == GL_TRUE || ( major == 4 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_4_0) = GLEW_VERSION_4_1 == GL_TRUE || ( major == 4 ) ? GL_TRUE : GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_3_3) = GLEW_VERSION_4_0 == GL_TRUE || ( major == 3 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_3_2) = GLEW_VERSION_3_3 == GL_TRUE || ( major == 3 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_3_1) = GLEW_VERSION_3_2 == GL_TRUE || ( major == 3 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_3_0) = GLEW_VERSION_3_1 == GL_TRUE || ( major == 3 ) ? GL_TRUE : GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_2_1) = GLEW_VERSION_3_0 == GL_TRUE || ( major == 2 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_2_0) = GLEW_VERSION_2_1 == GL_TRUE || ( major == 2 ) ? GL_TRUE : GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_5) = GLEW_VERSION_2_0 == GL_TRUE || ( major == 1 && minor >= 5 ) ? GL_TRUE : GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_4) = GLEW_VERSION_1_5 == GL_TRUE || ( major == 1 && minor >= 4 ) ? GL_TRUE : GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_3) = GLEW_VERSION_1_4 == GL_TRUE || ( major == 1 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_2_1) = GLEW_VERSION_1_3 == GL_TRUE ? GL_TRUE : GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_2) = GLEW_VERSION_1_2_1 == GL_TRUE || ( major == 1 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_1) = GLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_4_4 = ( major > 4 ) || ( major == 4 && minor >= 4 ) ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_4_3 = GLEW_VERSION_4_4 == GL_TRUE || ( major == 4 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_4_2 = GLEW_VERSION_4_3 == GL_TRUE || ( major == 4 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_4_1 = GLEW_VERSION_4_2 == GL_TRUE || ( major == 4 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_4_0 = GLEW_VERSION_4_1 == GL_TRUE || ( major == 4 ) ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_3_3 = GLEW_VERSION_4_0 == GL_TRUE || ( major == 3 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_3_2 = GLEW_VERSION_3_3 == GL_TRUE || ( major == 3 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_3_1 = GLEW_VERSION_3_2 == GL_TRUE || ( major == 3 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_3_0 = GLEW_VERSION_3_1 == GL_TRUE || ( major == 3 ) ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_2_1 = GLEW_VERSION_3_0 == GL_TRUE || ( major == 2 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_2_0 = GLEW_VERSION_2_1 == GL_TRUE || ( major == 2 ) ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_1_5 = GLEW_VERSION_2_0 == GL_TRUE || ( major == 1 && minor >= 5 ) ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_1_4 = GLEW_VERSION_1_5 == GL_TRUE || ( major == 1 && minor >= 4 ) ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_1_3 = GLEW_VERSION_1_4 == GL_TRUE || ( major == 1 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_1_2_1 = GLEW_VERSION_1_3 == GL_TRUE ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_1_2 = GLEW_VERSION_1_2_1 == GL_TRUE || ( major == 1 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
|
||||
GLEW_VERSION_1_1 = GLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
|
||||
}
|
||||
|
||||
/* query opengl extensions string */
|
||||
|
@ -20,11 +20,11 @@ GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST)
|
||||
/* initialize core GLX 1.2 */
|
||||
if (_glewInit_GLX_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT)) return GLEW_ERROR_GLX_VERSION_11_ONLY;
|
||||
/* initialize flags */
|
||||
CONST_CAST(GLXEW_VERSION_1_0) = GL_TRUE;
|
||||
CONST_CAST(GLXEW_VERSION_1_1) = GL_TRUE;
|
||||
CONST_CAST(GLXEW_VERSION_1_2) = GL_TRUE;
|
||||
CONST_CAST(GLXEW_VERSION_1_3) = GL_TRUE;
|
||||
CONST_CAST(GLXEW_VERSION_1_4) = GL_TRUE;
|
||||
GLXEW_VERSION_1_0 = GL_TRUE;
|
||||
GLXEW_VERSION_1_1 = GL_TRUE;
|
||||
GLXEW_VERSION_1_2 = GL_TRUE;
|
||||
GLXEW_VERSION_1_3 = GL_TRUE;
|
||||
GLXEW_VERSION_1_4 = GL_TRUE;
|
||||
/* query GLX version */
|
||||
glXQueryVersion(glXGetCurrentDisplay(), &major, &minor);
|
||||
if (major == 1 && minor <= 3)
|
||||
@ -32,11 +32,11 @@ GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST)
|
||||
switch (minor)
|
||||
{
|
||||
case 3:
|
||||
CONST_CAST(GLXEW_VERSION_1_4) = GL_FALSE;
|
||||
GLXEW_VERSION_1_4 = GL_FALSE;
|
||||
break;
|
||||
case 2:
|
||||
CONST_CAST(GLXEW_VERSION_1_4) = GL_FALSE;
|
||||
CONST_CAST(GLXEW_VERSION_1_3) = GL_FALSE;
|
||||
GLXEW_VERSION_1_4 = GL_FALSE;
|
||||
GLXEW_VERSION_1_3 = GL_FALSE;
|
||||
break;
|
||||
default:
|
||||
return GLEW_ERROR_GLX_VERSION_11_ONLY;
|
||||
|
@ -10,8 +10,8 @@ const GLubyte * GLEWAPIENTRY glewGetErrorString (GLenum error)
|
||||
(const GLubyte*)"GLX 1.2 and up are not supported",
|
||||
(const GLubyte*)"Unknown error"
|
||||
};
|
||||
const int max_error = sizeof(_glewErrorString)/sizeof(*_glewErrorString) - 1;
|
||||
return _glewErrorString[(int)error > max_error ? max_error : (int)error];
|
||||
const size_t max_error = sizeof(_glewErrorString)/sizeof(*_glewErrorString) - 1;
|
||||
return _glewErrorString[(size_t)error > max_error ? max_error : (size_t)error];
|
||||
}
|
||||
|
||||
const GLubyte * GLEWAPIENTRY glewGetString (GLenum name)
|
||||
@ -24,8 +24,8 @@ const GLubyte * GLEWAPIENTRY glewGetString (GLenum name)
|
||||
(const GLubyte*)"GLEW_VERSION_MINOR_STRING",
|
||||
(const GLubyte*)"GLEW_VERSION_MICRO_STRING"
|
||||
};
|
||||
const int max_string = sizeof(_glewString)/sizeof(*_glewString) - 1;
|
||||
return _glewString[(int)name > max_string ? 0 : (int)name];
|
||||
const size_t max_string = sizeof(_glewString)/sizeof(*_glewString) - 1;
|
||||
return _glewString[(size_t)name > max_string ? 0 : (size_t)name];
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
@ -168,13 +168,13 @@ main (int argc, char** argv)
|
||||
fprintf(file, "OpenGL renderer string: %s\n", glGetString(GL_RENDERER));
|
||||
fprintf(file, "OpenGL version string: %s\n", glGetString(GL_VERSION));
|
||||
fprintf(file, "OpenGL extensions (GL_): \n");
|
||||
PrintExtensions((char*)glGetString(GL_EXTENSIONS));
|
||||
PrintExtensions((const char*)glGetString(GL_EXTENSIONS));
|
||||
|
||||
#ifndef GLEW_NO_GLU
|
||||
/* GLU extensions */
|
||||
fprintf(file, "GLU version string: %s\n", gluGetString(GLU_VERSION));
|
||||
fprintf(file, "GLU extensions (GLU_): \n");
|
||||
PrintExtensions((char*)gluGetString(GLU_EXTENSIONS));
|
||||
PrintExtensions((const char*)gluGetString(GLU_EXTENSIONS));
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -185,8 +185,8 @@ main (int argc, char** argv)
|
||||
{
|
||||
fprintf(file, "WGL extensions (WGL_): \n");
|
||||
PrintExtensions(wglGetExtensionsStringARB ?
|
||||
(char*)wglGetExtensionsStringARB(ctx.dc) :
|
||||
(char*)wglGetExtensionsStringEXT());
|
||||
(const char*)wglGetExtensionsStringARB(ctx.dc) :
|
||||
(const char*)wglGetExtensionsStringEXT());
|
||||
}
|
||||
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user