mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-26 15:51:56 +00:00
const correctness change
git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@498 783a27ee-832a-0410-bc00-9f386506c6dd
This commit is contained in:
parent
4eac405113
commit
c9a40e3cee
@ -43,16 +43,16 @@ if (@ARGV)
|
|||||||
#my $pextvar = prefix_varname($extvar);
|
#my $pextvar = prefix_varname($extvar);
|
||||||
|
|
||||||
print "#ifdef $extname\n";
|
print "#ifdef $extname\n";
|
||||||
print " " . $extvar . " = " . $extpre . "GetExtension(\"$extname\");\n";
|
print " CONST_CAST(" . $extvar . ") = " . $extpre . "GetExtension(\"$extname\");\n";
|
||||||
if (keys %$functions)
|
if (keys %$functions)
|
||||||
{
|
{
|
||||||
if ($extname =~ /WGL_.*/)
|
if ($extname =~ /WGL_.*/)
|
||||||
{
|
{
|
||||||
print " if (glewExperimental || " . $extvar . "|| crippled) " . $extvar . "= !_glewInit_$extname(GLEW_CONTEXT_ARG_VAR_INIT);\n";
|
print " if (glewExperimental || " . $extvar . "|| crippled) CONST_CAST(" . $extvar . ")= !_glewInit_$extname(GLEW_CONTEXT_ARG_VAR_INIT);\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print " if (glewExperimental || " . $extvar . ") " . $extvar . " = !_glewInit_$extname(GLEW_CONTEXT_ARG_VAR_INIT);\n";
|
print " if (glewExperimental || " . $extvar . ") CONST_CAST(" . $extvar . ") = !_glewInit_$extname(GLEW_CONTEXT_ARG_VAR_INIT);\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "#endif /* $extname */\n";
|
print "#endif /* $extname */\n";
|
||||||
|
@ -101,11 +101,15 @@ void* dlGetProcAddress (const GLubyte* name)
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define GLboolean const cast.
|
||||||
|
*/
|
||||||
|
#define CONST_CAST(x) (*(GLboolean*)&x)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GLEW, just like OpenGL or GLU, does not rely on the standard C library.
|
* GLEW, just like OpenGL or GLU, does not rely on the standard C library.
|
||||||
* These functions implement the functionality required in this file.
|
* These functions implement the functionality required in this file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static GLuint _glewStrLen (const GLubyte* s)
|
static GLuint _glewStrLen (const GLubyte* s)
|
||||||
{
|
{
|
||||||
GLuint i=0;
|
GLuint i=0;
|
||||||
|
@ -45,65 +45,65 @@ GLenum glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GLEW_VERSION_1_1 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_1_1) = GL_TRUE;
|
||||||
if (s[major] >= '2')
|
if (s[major] >= '2')
|
||||||
{
|
{
|
||||||
GLEW_VERSION_1_2 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_1_2) = GL_TRUE;
|
||||||
GLEW_VERSION_1_3 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_1_3) = GL_TRUE;
|
||||||
GLEW_VERSION_1_4 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_1_4) = GL_TRUE;
|
||||||
GLEW_VERSION_1_5 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_1_5) = GL_TRUE;
|
||||||
GLEW_VERSION_2_0 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_2_0) = GL_TRUE;
|
||||||
if (s[minor] >= '1')
|
if (s[minor] >= '1')
|
||||||
{
|
{
|
||||||
GLEW_VERSION_2_1 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_2_1) = GL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (s[minor] >= '5')
|
if (s[minor] >= '5')
|
||||||
{
|
{
|
||||||
GLEW_VERSION_1_2 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_1_2) = GL_TRUE;
|
||||||
GLEW_VERSION_1_3 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_1_3) = GL_TRUE;
|
||||||
GLEW_VERSION_1_4 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_1_4) = GL_TRUE;
|
||||||
GLEW_VERSION_1_5 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_1_5) = GL_TRUE;
|
||||||
GLEW_VERSION_2_0 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_2_0) = GL_FALSE;
|
||||||
GLEW_VERSION_2_1 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_2_1) = GL_FALSE;
|
||||||
}
|
}
|
||||||
if (s[minor] == '4')
|
if (s[minor] == '4')
|
||||||
{
|
{
|
||||||
GLEW_VERSION_1_2 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_1_2) = GL_TRUE;
|
||||||
GLEW_VERSION_1_3 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_1_3) = GL_TRUE;
|
||||||
GLEW_VERSION_1_4 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_1_4) = GL_TRUE;
|
||||||
GLEW_VERSION_1_5 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_1_5) = GL_FALSE;
|
||||||
GLEW_VERSION_2_0 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_2_0) = GL_FALSE;
|
||||||
GLEW_VERSION_2_1 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_2_1) = GL_FALSE;
|
||||||
}
|
}
|
||||||
if (s[minor] == '3')
|
if (s[minor] == '3')
|
||||||
{
|
{
|
||||||
GLEW_VERSION_1_2 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_1_2) = GL_TRUE;
|
||||||
GLEW_VERSION_1_3 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_1_3) = GL_TRUE;
|
||||||
GLEW_VERSION_1_4 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_1_4) = GL_FALSE;
|
||||||
GLEW_VERSION_1_5 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_1_5) = GL_FALSE;
|
||||||
GLEW_VERSION_2_0 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_2_0) = GL_FALSE;
|
||||||
GLEW_VERSION_2_1 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_2_1) = GL_FALSE;
|
||||||
}
|
}
|
||||||
if (s[minor] == '2')
|
if (s[minor] == '2')
|
||||||
{
|
{
|
||||||
GLEW_VERSION_1_2 = GL_TRUE;
|
CONST_CAST(GLEW_VERSION_1_2) = GL_TRUE;
|
||||||
GLEW_VERSION_1_3 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_1_3) = GL_FALSE;
|
||||||
GLEW_VERSION_1_4 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_1_4) = GL_FALSE;
|
||||||
GLEW_VERSION_1_5 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_1_5) = GL_FALSE;
|
||||||
GLEW_VERSION_2_0 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_2_0) = GL_FALSE;
|
||||||
GLEW_VERSION_2_1 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_2_1) = GL_FALSE;
|
||||||
}
|
}
|
||||||
if (s[minor] < '2')
|
if (s[minor] < '2')
|
||||||
{
|
{
|
||||||
GLEW_VERSION_1_2 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_1_2) = GL_FALSE;
|
||||||
GLEW_VERSION_1_3 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_1_3) = GL_FALSE;
|
||||||
GLEW_VERSION_1_4 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_1_4) = GL_FALSE;
|
||||||
GLEW_VERSION_1_5 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_1_5) = GL_FALSE;
|
||||||
GLEW_VERSION_2_0 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_2_0) = GL_FALSE;
|
||||||
GLEW_VERSION_2_1 = GL_FALSE;
|
CONST_CAST(GLEW_VERSION_2_1) = GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,11 +26,11 @@ GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST)
|
|||||||
/* initialize core GLX 1.2 */
|
/* initialize core GLX 1.2 */
|
||||||
if (_glewInit_GLX_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT)) return GLEW_ERROR_GLX_VERSION_11_ONLY;
|
if (_glewInit_GLX_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT)) return GLEW_ERROR_GLX_VERSION_11_ONLY;
|
||||||
/* initialize flags */
|
/* initialize flags */
|
||||||
GLXEW_VERSION_1_0 = GL_TRUE;
|
CONST_CAST(GLXEW_VERSION_1_0) = GL_TRUE;
|
||||||
GLXEW_VERSION_1_1 = GL_TRUE;
|
CONST_CAST(GLXEW_VERSION_1_1) = GL_TRUE;
|
||||||
GLXEW_VERSION_1_2 = GL_TRUE;
|
CONST_CAST(GLXEW_VERSION_1_2) = GL_TRUE;
|
||||||
GLXEW_VERSION_1_3 = GL_TRUE;
|
CONST_CAST(GLXEW_VERSION_1_3) = GL_TRUE;
|
||||||
GLXEW_VERSION_1_4 = GL_TRUE;
|
CONST_CAST(GLXEW_VERSION_1_4) = GL_TRUE;
|
||||||
/* query GLX version */
|
/* query GLX version */
|
||||||
glXQueryVersion(glXGetCurrentDisplay(), &major, &minor);
|
glXQueryVersion(glXGetCurrentDisplay(), &major, &minor);
|
||||||
if (major == 1 && minor <= 3)
|
if (major == 1 && minor <= 3)
|
||||||
@ -38,11 +38,11 @@ GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST)
|
|||||||
switch (minor)
|
switch (minor)
|
||||||
{
|
{
|
||||||
case 3:
|
case 3:
|
||||||
GLXEW_VERSION_1_4 = GL_FALSE;
|
CONST_CAST(GLXEW_VERSION_1_4) = GL_FALSE;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
GLXEW_VERSION_1_4 = GL_FALSE;
|
CONST_CAST(GLXEW_VERSION_1_4) = GL_FALSE;
|
||||||
GLXEW_VERSION_1_3 = GL_FALSE;
|
CONST_CAST(GLXEW_VERSION_1_3) = GL_FALSE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return GLEW_ERROR_GLX_VERSION_11_ONLY;
|
return GLEW_ERROR_GLX_VERSION_11_ONLY;
|
||||||
|
@ -21,11 +21,10 @@ GLEWAPI GLboolean glewContextIsSupported (GLEWContext* ctx, const char* name);
|
|||||||
#define glewIsSupported(x) glewContextIsSupported(glewGetContext(), x)
|
#define glewIsSupported(x) glewContextIsSupported(glewGetContext(), x)
|
||||||
#define glewIsExtensionSupported(x) glewIsSupported(x)
|
#define glewIsExtensionSupported(x) glewIsSupported(x)
|
||||||
|
|
||||||
|
#define GLEW_GET_VAR(x) (*(const GLboolean*)&(glewGetContext()->x))
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# define GLEW_GET_VAR(x) glewGetContext()->x
|
|
||||||
# define GLEW_GET_FUN(x) glewGetContext()->x
|
# define GLEW_GET_FUN(x) glewGetContext()->x
|
||||||
#else
|
#else
|
||||||
# define GLEW_GET_VAR(x) glewGetContext()->x
|
|
||||||
# define GLEW_GET_FUN(x) x
|
# define GLEW_GET_FUN(x) x
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -35,7 +34,7 @@ GLEWAPI GLenum glewInit ();
|
|||||||
GLEWAPI GLboolean glewIsSupported (const char* name);
|
GLEWAPI GLboolean glewIsSupported (const char* name);
|
||||||
#define glewIsExtensionSupported(x) glewIsSupported(x)
|
#define glewIsExtensionSupported(x) glewIsSupported(x)
|
||||||
|
|
||||||
#define GLEW_GET_VAR(x) x
|
#define GLEW_GET_VAR(x) (*(const GLboolean*)&x)
|
||||||
#define GLEW_GET_FUN(x) x
|
#define GLEW_GET_FUN(x) x
|
||||||
|
|
||||||
#endif /* GLEW_MX */
|
#endif /* GLEW_MX */
|
||||||
|
Loading…
Reference in New Issue
Block a user