diff --git a/auto/Makefile b/auto/Makefile index a8d1655..21918a6 100644 --- a/auto/Makefile +++ b/auto/Makefile @@ -62,7 +62,7 @@ $(I.DEST)/glew.h: $(EXT)/.dummy $(BIN)/make_header.pl GLAPIENTRY GL $(CORE)/GL_VERSION* >> $@ $(BIN)/make_header.pl GLAPIENTRY GL $(EXT)/GL_* >> $@ $(BIN)/make_struct.pl GL $(CORE)/GL_VERSION* $(EXT)/GL_* >> $@ - perl -e 's/ GLboolean __GLEW_VERSION_1_2;/ GLboolean __GLEW_VERSION_1_1;\n GLboolean __GLEW_VERSION_1_2;/' -pi.bak $@ + perl -e 's/GLEW_EXPORT GLboolean __GLEW_VERSION_1_2;/GLEW_EXPORT GLboolean __GLEW_VERSION_1_1;\nGLEW_EXPORT GLboolean __GLEW_VERSION_1_2;/' -pi.bak $@ rm -f $@.bak cat $(SRC)/glew_post.h >> $@ @@ -83,6 +83,14 @@ $(I.DEST)/glxew.h: $(EXT)/.dummy $(S.DEST)/glew.c: $(EXT)/.dummy cp -f $(SRC)/glew_pre.c $@ + $(BIN)/make_struct_def.pl GL $(CORE)/GL_VERSION* $(EXT)/GL_* >> $@ + echo -e "\n#endif /* !_WIN32 || !GLEW_MX */\n" >> $@ + echo -e "#if defined(_WIN32) && !defined(GLEW_MX)" >> $@ + $(BIN)/make_struct_def.pl WGL $(EXT)/WGL_* >> $@ + echo -e "\n#endif /* _WIN32 && !GLEW_MX */\n" >> $@ + echo -e "#if !(defined(_WIN32) || (defined(__APPLE__) && !defined(GLEW_APPLE_GLX)))" >> $@ + $(BIN)/make_struct_def.pl GLX $(EXT)/GLX_* >> $@ + echo -e "\n#endif /* !_WIN32 */\n" >> $@ $(BIN)/make_init.pl GL $(CORE)/GL_VERSION* >> $@ $(BIN)/make_init.pl GL $(EXT)/GL_* >> $@ echo -e "#ifdef _WIN32\n" >> $@ diff --git a/auto/bin/make_header.pl b/auto/bin/make_header.pl index 29b70c3..c97c04e 100755 --- a/auto/bin/make_header.pl +++ b/auto/bin/make_header.pl @@ -37,13 +37,7 @@ sub make_pfn_type($%) sub make_pfn_alias($%) { our $type; - return join(" ", "#define", $_[0], $type . "EW_GET_CONTEXT(" . prefixname($_[0]) . ")") -} - -# function pointer declaration -sub make_pfn_decl($%) -{ - return "GLEWAPI PFN" . (uc $_[0]) . "PROC " . prefixname($_[0]) . ";"; + return join(" ", "#define", $_[0], $type . "EW_GET_FUN(" . prefixname($_[0]) . ")") } my @extlist = (); @@ -70,12 +64,11 @@ foreach my $ext (sort @extlist) output_types($types, \&make_type); output_exacts($exacts, \&make_exact); output_decls($functions, \&make_pfn_type); - #output_decls($functions, \&make_pfn_decl); output_decls($functions, \&make_pfn_alias); my $extvar = $extname; $extvar =~ s/GL(X*)_/GL$1EW_/; - print "\n#define $extvar " . $type . "EW_GET_CONTEXT(" . prefix_varname($extvar) . ")\n"; + print "\n#define $extvar " . $type . "EW_GET_VAR(" . prefix_varname($extvar) . ")\n"; print "\n#endif /* $extname */\n\n"; } diff --git a/auto/bin/make_init.pl b/auto/bin/make_init.pl index 2c05548..62720ed 100755 --- a/auto/bin/make_init.pl +++ b/auto/bin/make_init.pl @@ -12,16 +12,16 @@ use warnings; do 'bin/make.pl'; -#--------------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- # function pointer definition sub make_pfn_def_init($%) { - my $name = prefixname($_[0]); - return " r = ((ctx->" . $name . " = (PFN" . (uc $_[0]) . "PROC)glewGetProcAddress((const GLubyte*)\"" . $_[0] . "\")) == NULL) || r;"; + #my $name = prefixname($_[0]); + return " r = ((" . $_[0] . " = (PFN" . (uc $_[0]) . "PROC)glewGetProcAddress((const GLubyte*)\"" . $_[0] . "\")) == NULL) || r;"; } -#--------------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- my @extlist = (); my %extensions = (); @@ -38,7 +38,8 @@ if (@ARGV) foreach my $ext (sort @extlist) { - my ($extname, $exturl, $types, $tokens, $functions, $exacts) = parse_ext($ext); + my ($extname, $exturl, $types, $tokens, $functions, $exacts) = + parse_ext($ext); make_separator($extname); print "#ifdef $extname\n\n"; @@ -47,7 +48,8 @@ foreach my $ext (sort @extlist) $extvar =~ s/GL(X*)_/GL$1EW_/; if (keys %$functions) { - print "static GLboolean _glewInit_$extname (" . $type . "EWContext* ctx)\n{\n GLboolean r = GL_FALSE;\n"; + print "static GLboolean _glewInit_$extname (" . $type . + "EWContext* ctx)\n{\n GLboolean r = GL_FALSE;\n"; output_decls($functions, \&make_pfn_def_init); print "\n return r;\n}\n"; } diff --git a/auto/bin/make_list.pl b/auto/bin/make_list.pl index f145fae..b2542e3 100755 --- a/auto/bin/make_list.pl +++ b/auto/bin/make_list.pl @@ -18,7 +18,7 @@ do 'bin/make.pl'; sub make_init_call($%) { my $name = prefixname($_[0]); - return " r = r || (ctx->" . $name . " = (PFN" . (uc $_[0]) . "PROC)glewGetProcAddress(\"" . $name . "\")) == NULL;"; + return " r = r || (" . $_[0] . " = (PFN" . (uc $_[0]) . "PROC)glewGetProcAddress(\"" . $name . "\")) == NULL;"; } #--------------------------------------------------------------------------------------- @@ -44,19 +44,19 @@ foreach my $ext (sort @extlist) my $extpre = $extname; $extpre =~ s/^(W?)GL(X?).*$/\l$1gl\l$2ew/; - my $pextvar = prefix_varname($extvar); + #my $pextvar = prefix_varname($extvar); print "#ifdef $extname\n"; - print " ctx->" . $pextvar . "= " . $extpre . "GetExtension(\"$extname\");\n"; + print " " . $extvar . "= " . $extpre . "GetExtension(\"$extname\");\n"; if (keys %$functions) { if ($extname =~ /WGL_.*/) { - print " if (glewExperimental || ctx->" . $pextvar . "|| crippled) ctx->" . $pextvar . "= !_glewInit_$extname(ctx);\n"; + print " if (glewExperimental || " . $extvar . "|| crippled) " . $extvar . "= !_glewInit_$extname(ctx);\n"; } else { - print " if (glewExperimental || ctx->" . $pextvar . ") ctx->" . $pextvar . " = !_glewInit_$extname(ctx);\n"; + print " if (glewExperimental || " . $extvar . ") " . $extvar . " = !_glewInit_$extname(ctx);\n"; } } print "#endif /* $extname */\n"; diff --git a/auto/bin/make_struct.pl b/auto/bin/make_struct.pl index 2c985e1..bea96a9 100755 --- a/auto/bin/make_struct.pl +++ b/auto/bin/make_struct.pl @@ -15,7 +15,7 @@ do 'bin/make.pl'; # function pointer declaration sub make_pfn_decl($%) { - return " PFN" . (uc $_[0]) . "PROC " . prefixname($_[0]) . ";"; + return "GLEW_EXPORT PFN" . (uc $_[0]) . "PROC " . prefixname($_[0]) . ";"; } my @extlist = (); @@ -32,7 +32,14 @@ if (@ARGV) } print "/* ------------------------------------------------------------------------- */\n\n"; -print "struct " . $type . "EWContextStruct\n{"; +print "#ifdef GLEW_MX\n"; +print "#define GLEW_EXPORT\n"; +print "#else\n"; +print "#define GLEW_EXPORT GLEWAPI\n"; +print "#endif /* GLEW_MX */\n\n"; +print "#if defined(GLEW_MX) && defined(_WIN32)\n"; +print "struct " . $type . "EWContextStruct\n{\n"; +print "#endif /* GLEW_MX */\n"; foreach my $ext (sort @extlist) { @@ -40,14 +47,18 @@ foreach my $ext (sort @extlist) output_decls($functions, \&make_pfn_decl); } -print "\n"; +print "\n#if defined(GLEW_MX) && !defined(_WIN32)\n"; +print "struct " . $type . "EWContextStruct\n{\n"; +print "#endif /* GLEW_MX */\n\n"; foreach my $ext (sort @extlist) { my ($extname, $exturl, $types, $tokens, $functions, $exacts) = parse_ext($ext); my $extvar = $extname; $extvar =~ s/GL(X*)_/GL$1EW_/; - print " GLboolean " . prefix_varname($extvar) . ";\n"; + print "GLEW_EXPORT GLboolean " . prefix_varname($extvar) . ";\n"; } -print "\n}; /* " . $type . "EWContextStruct */\n\n"; +print "\n#ifdef GLEW_MX\n"; +print "}; /* " . $type . "EWContextStruct */\n"; +print "#endif /* GLEW_MX */\n\n"; diff --git a/auto/src/glew_gl.c b/auto/src/glew_gl.c index c74f68f..7952977 100644 --- a/auto/src/glew_gl.c +++ b/auto/src/glew_gl.c @@ -51,6 +51,9 @@ GLboolean glewGetExtension (const char* name) /* ------------------------------------------------------------------------- */ +#ifndef GLEW_MX +static +#endif GLenum glewContextInit (GLEWContext* ctx) { const GLubyte* s; @@ -67,43 +70,43 @@ GLenum glewContextInit (GLEWContext* ctx) { if (s[3] >= '5') { - ctx->__GLEW_VERSION_1_1 = GL_TRUE; - ctx->__GLEW_VERSION_1_2 = GL_TRUE; - ctx->__GLEW_VERSION_1_3 = GL_TRUE; - ctx->__GLEW_VERSION_1_4 = GL_TRUE; - ctx->__GLEW_VERSION_1_5 = GL_TRUE; + GLEW_VERSION_1_1 = GL_TRUE; + GLEW_VERSION_1_2 = GL_TRUE; + GLEW_VERSION_1_3 = GL_TRUE; + GLEW_VERSION_1_4 = GL_TRUE; + GLEW_VERSION_1_5 = GL_TRUE; } if (s[2] == '4') { - ctx->__GLEW_VERSION_1_1 = GL_TRUE; - ctx->__GLEW_VERSION_1_2 = GL_TRUE; - ctx->__GLEW_VERSION_1_3 = GL_TRUE; - ctx->__GLEW_VERSION_1_4 = GL_TRUE; - ctx->__GLEW_VERSION_1_5 = GL_FALSE; + GLEW_VERSION_1_1 = GL_TRUE; + GLEW_VERSION_1_2 = GL_TRUE; + GLEW_VERSION_1_3 = GL_TRUE; + GLEW_VERSION_1_4 = GL_TRUE; + GLEW_VERSION_1_5 = GL_FALSE; } if (s[2] == '3') { - ctx->__GLEW_VERSION_1_1 = GL_TRUE; - ctx->__GLEW_VERSION_1_2 = GL_TRUE; - ctx->__GLEW_VERSION_1_3 = GL_TRUE; - ctx->__GLEW_VERSION_1_4 = GL_FALSE; - ctx->__GLEW_VERSION_1_5 = GL_FALSE; + GLEW_VERSION_1_1 = GL_TRUE; + GLEW_VERSION_1_2 = GL_TRUE; + GLEW_VERSION_1_3 = GL_TRUE; + GLEW_VERSION_1_4 = GL_FALSE; + GLEW_VERSION_1_5 = GL_FALSE; } if (s[2] == '2') { - ctx->__GLEW_VERSION_1_1 = GL_TRUE; - ctx->__GLEW_VERSION_1_2 = GL_TRUE; - ctx->__GLEW_VERSION_1_3 = GL_FALSE; - ctx->__GLEW_VERSION_1_4 = GL_FALSE; - ctx->__GLEW_VERSION_1_5 = GL_FALSE; + GLEW_VERSION_1_1 = GL_TRUE; + GLEW_VERSION_1_2 = GL_TRUE; + GLEW_VERSION_1_3 = GL_FALSE; + GLEW_VERSION_1_4 = GL_FALSE; + GLEW_VERSION_1_5 = GL_FALSE; } if (s[2] < '2') { - ctx->__GLEW_VERSION_1_1 = GL_TRUE; - ctx->__GLEW_VERSION_1_2 = GL_FALSE; - ctx->__GLEW_VERSION_1_3 = GL_FALSE; - ctx->__GLEW_VERSION_1_4 = GL_FALSE; - ctx->__GLEW_VERSION_1_5 = GL_FALSE; + GLEW_VERSION_1_1 = GL_TRUE; + GLEW_VERSION_1_2 = GL_FALSE; + GLEW_VERSION_1_3 = GL_FALSE; + GLEW_VERSION_1_4 = GL_FALSE; + GLEW_VERSION_1_5 = GL_FALSE; } } /* initialize extensions */ diff --git a/auto/src/glew_glx.c b/auto/src/glew_glx.c index c6e3ef2..a73fb4b 100644 --- a/auto/src/glew_glx.c +++ b/auto/src/glew_glx.c @@ -8,8 +8,8 @@ GLboolean glxewGetExtension (const char* name) GLubyte* p; GLubyte* end; GLuint len = _glewStrLen((const GLubyte*)name); - if (glXQueryExtensionsString == NULL || glxewDefaultContext->__glewXGetCurrentDisplay == NULL) return GL_FALSE; - p = (GLubyte*)glXQueryExtensionsString(glxewDefaultContext->__glewXGetCurrentDisplay(), DefaultScreen(glxewDefaultContext->__glewXGetCurrentDisplay())); + if (glXQueryExtensionsString == NULL || glXGetCurrentDisplay == NULL) return GL_FALSE; + p = (GLubyte*)glXQueryExtensionsString(glXGetCurrentDisplay(), DefaultScreen(glXGetCurrentDisplay())); if (0 == p) return GL_FALSE; end = p + _glewStrLen(p); while (p < end) @@ -21,29 +21,32 @@ GLboolean glxewGetExtension (const char* name) return GL_FALSE; } +#ifndef GLEW_MX +static +#endif GLenum glxewContextInit (GLXEWContext* ctx) { int major, minor; /* initialize core GLX 1.2 */ if (_glewInit_GLX_VERSION_1_2(ctx)) return GLEW_ERROR_GLX_VERSION_11_ONLY; - glxewDefaultContext->__glewXGetCurrentDisplay = ctx->__glewXGetCurrentDisplay; + /* initialize flags */ + GLXEW_VERSION_1_0 = GL_FALSE; + GLXEW_VERSION_1_1 = GL_FALSE; + GLXEW_VERSION_1_2 = GL_FALSE; + GLXEW_VERSION_1_3 = GL_FALSE; + GLXEW_VERSION_1_4 = GL_FALSE; /* query GLX version */ glXQueryVersion(glXGetCurrentDisplay(), &major, &minor); - ctx->__GLXEW_VERSION_1_0 = GL_FALSE; - ctx->__GLXEW_VERSION_1_1 = GL_FALSE; - ctx->__GLXEW_VERSION_1_2 = GL_FALSE; - ctx->__GLXEW_VERSION_1_3 = GL_FALSE; - ctx->__GLXEW_VERSION_1_4 = GL_FALSE; switch (minor) { case 4: - ctx->__GLXEW_VERSION_1_4 = GL_TRUE; + GLXEW_VERSION_1_4 = GL_TRUE; case 3: - ctx->__GLXEW_VERSION_1_3 = GL_TRUE; + GLXEW_VERSION_1_3 = GL_TRUE; case 2: - ctx->__GLXEW_VERSION_1_2 = GL_TRUE; - ctx->__GLXEW_VERSION_1_1 = GL_TRUE; - ctx->__GLXEW_VERSION_1_0 = GL_TRUE; + GLXEW_VERSION_1_2 = GL_TRUE; + GLXEW_VERSION_1_1 = GL_TRUE; + GLXEW_VERSION_1_0 = GL_TRUE; break; default: return GLEW_ERROR_GLX_VERSION_11_ONLY; diff --git a/auto/src/glew_post.c b/auto/src/glew_post.c index 9b5b949..d4aa7f9 100644 --- a/auto/src/glew_post.c +++ b/auto/src/glew_post.c @@ -34,15 +34,23 @@ const GLubyte* glewGetString (GLenum name) GLboolean glewExperimental = GL_FALSE; +#ifndef GLEW_MX + GLenum glewInit () { GLenum r; - if ( (r = glewContextInit(glewDefaultContext)) ) return r; + if ( (r = glewContextInit(0)) ) return r; #if defined(_WIN32) - return wglewContextInit(wglewDefaultContext); + return wglewContextInit(0); #elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */ - return glxewContextInit(glxewDefaultContext); + return glxewContextInit(0); #else return r; #endif /* _WIN32 */ } + +#else + + +#endif + diff --git a/auto/src/glew_post.h b/auto/src/glew_post.h index 3964bac..69eaf29 100644 --- a/auto/src/glew_post.h +++ b/auto/src/glew_post.h @@ -12,19 +12,28 @@ /* API */ #ifdef GLEW_MX -# define GLEW_GET_CONTEXT(x) glewGetContext()->x -#else -# define GLEW_GET_CONTEXT(x) glewDefaultContext->x -#endif /* GLEW_MX */ typedef struct GLEWContextStruct GLEWContext; - -GLEWAPI GLEWContext* glewDefaultContext; -GLEWAPI GLboolean glewExperimental; - -GLEWAPI GLenum glewInit (); GLEWAPI GLenum glewContextInit (GLEWContext* ctx); +#ifdef _WIN32 +# define GLEW_GET_VAR(x) glewGetContext()->x +# define GLEW_GET_FUN(x) glewGetContext()->x +#else +# define GLEW_GET_VAR(x) glewGetContext()->x +# define GLEW_GET_FUN(x) x +#endif + +#else /* GLEW_MX */ + +GLEWAPI GLenum glewInit (); + +#define GLEW_GET_VAR(x) x +#define GLEW_GET_FUN(x) x + +#endif /* GLEW_MX */ + +GLEWAPI GLboolean glewExperimental; GLEWAPI GLboolean glewGetExtension (const char* name); GLEWAPI const GLubyte* glewGetErrorString (GLenum error); GLEWAPI const GLubyte* glewGetString (GLenum name); @@ -49,7 +58,6 @@ GLEWAPI const GLubyte* glewGetString (GLenum name); #undef WINGDIAPI #endif -/* #undef GLEW_GET_CONTEXT */ #undef GLAPI /* #undef GLEWAPI */ diff --git a/auto/src/glew_pre.c b/auto/src/glew_pre.c index 9bcd17b..e481a56 100644 --- a/auto/src/glew_pre.c +++ b/auto/src/glew_pre.c @@ -94,14 +94,15 @@ static void *dlGetProcAddress (const GLubyte* name) } #endif /* __sgi || __sun */ -GLEWContext _glewDefaultContext; -GLEWContext* glewDefaultContext = &_glewDefaultContext; - -#if defined(_WIN32) -WGLEWContext _wglewDefaultContext; -WGLEWContext* wglewDefaultContext = &_wglewDefaultContext; -#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) -GLXEWContext _glxewDefaultContext; -GLXEWContext* glxewDefaultContext = &_glxewDefaultContext; +#ifdef GLEW_MX +#define glewGetContext() ctx +#else +#define GLEWContext void +#define WGLEWContext void +#define GLXEWContext void #endif +#if !defined(_WIN32) || !defined(GLEW_MX) + +GLboolean __GLEW_VERSION_1_1 = GL_FALSE; + diff --git a/auto/src/glew_pre.h b/auto/src/glew_pre.h index 6f7c7ba..081ced2 100644 --- a/auto/src/glew_pre.h +++ b/auto/src/glew_pre.h @@ -1091,7 +1091,7 @@ GLAPI void GLAPIENTRY glVertex4sv (const GLshort *v); GLAPI void GLAPIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); GLAPI void GLAPIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); -#define GLEW_VERSION_1_1 GLEW_GET_CONTEXT(__GLEW_VERSION_1_1) +#define GLEW_VERSION_1_1 GLEW_GET_VAR(__GLEW_VERSION_1_1) #endif /* GL_VERSION_1_1 */ diff --git a/auto/src/glew_wgl.c b/auto/src/glew_wgl.c index 756574f..54af134 100644 --- a/auto/src/glew_wgl.c +++ b/auto/src/glew_wgl.c @@ -5,18 +5,21 @@ #ifdef _WIN32 +static PFNWGLGETEXTENSIONSSTRINGARBPROC _wglewGetExtensionsStringARB = NULL; +static PFNWGLGETEXTENSIONSSTRINGEXTPROC _wglewGetExtensionsStringEXT = NULL; + GLboolean wglewGetExtension (const char* name) { GLubyte* p; GLubyte* end; GLuint len = _glewStrLen((const GLubyte*)name); - if (wglewDefaultContext->__wglewGetExtensionsStringARB == NULL) - if (wglewDefaultContext->__wglewGetExtensionsStringEXT == NULL) + if (_wglewGetExtensionsStringARB == NULL) + if (_wglewGetExtensionsStringEXT == NULL) return GL_FALSE; else - p = (GLubyte*)wglewDefaultContext->__wglewGetExtensionsStringEXT(); + p = (GLubyte*)_wglewGetExtensionsStringEXT(); else - p = (GLubyte*)wglewDefaultContext->__wglewGetExtensionsStringARB(wglGetCurrentDC()); + p = (GLubyte*)_wglewGetExtensionsStringARB(wglGetCurrentDC()); if (0 == p) return GL_FALSE; end = p + _glewStrLen(p); while (p < end) @@ -28,17 +31,16 @@ GLboolean wglewGetExtension (const char* name) return GL_FALSE; } +#ifndef GLEW_MX +static +#endif GLenum wglewContextInit (WGLEWContext* ctx) { GLboolean crippled; /* find wgl extension string query functions */ - _glewInit_WGL_ARB_extensions_string(ctx); - ctx->__WGLEW_ARB_extensions_string = (ctx->__wglewGetExtensionsStringARB != NULL); - wglewDefaultContext->__wglewGetExtensionsStringARB = ctx->__wglewGetExtensionsStringARB; - wglewDefaultContext->__WGLEW_ARB_extensions_string = ctx->__WGLEW_ARB_extensions_string; - _glewInit_WGL_EXT_extensions_string(ctx); - ctx->__WGLEW_EXT_extensions_string = (ctx->__wglewGetExtensionsStringEXT != NULL); - wglewDefaultContext->__wglewGetExtensionsStringEXT = ctx->__wglewGetExtensionsStringEXT; - wglewDefaultContext->__WGLEW_EXT_extensions_string = ctx->__WGLEW_EXT_extensions_string; + if (_wglewGetExtensionsStringARB == NULL) + _wglewGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringARB"); + if (_wglewGetExtensionsStringEXT == NULL) + _wglewGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringEXT"); /* initialize extensions */ - crippled = !(ctx->__WGLEW_ARB_extensions_string || ctx->__WGLEW_EXT_extensions_string); + crippled = _wglewGetExtensionsStringARB == NULL && _wglewGetExtensionsStringEXT == NULL; diff --git a/auto/src/glxew_post.h b/auto/src/glxew_post.h index 31aec4a..b66bf82 100644 --- a/auto/src/glxew_post.h +++ b/auto/src/glxew_post.h @@ -1,16 +1,20 @@ /* ------------------------------------------------------------------------ */ -typedef struct GLXEWContextStruct GLXEWContext; -GLEWAPI GLXEWContext* glxewDefaultContext; - #ifdef GLEW_MX -extern GLXEWContext* glxewGetContext(); -# define GLXEW_GET_CONTEXT(x) glxewGetContext()->x -#else -# define GLXEW_GET_CONTEXT(x) glxewDefaultContext->x + +typedef struct GLXEWContextStruct GLXEWContext; +extern GLenum glxewContextInit (GLXEWContext* ctx); + +#define GLXEW_GET_VAR(x) glxewGetContext()->x +#define GLXEW_GET_FUN(x) x + +#else /* GLEW_MX */ + +#define GLXEW_GET_VAR(x) x +#define GLXEW_GET_FUN(x) x + #endif /* GLEW_MX */ -extern GLenum glxewContextInit (GLXEWContext* ctx); extern GLboolean glxewGetExtension (const char* name); #ifdef __cplusplus diff --git a/auto/src/wglew_post.h b/auto/src/wglew_post.h index d3c3545..7e63a90 100644 --- a/auto/src/wglew_post.h +++ b/auto/src/wglew_post.h @@ -1,23 +1,26 @@ /* ------------------------------------------------------------------------- */ -typedef struct WGLEWContextStruct WGLEWContext; -GLEWAPI WGLEWContext* wglewDefaultContext; - #ifdef GLEW_MX -extern WGLEWContext* wglewGetContext(); -# define WGLEW_GET_CONTEXT(x) wglewGetContext()->x -#else -# define WGLEW_GET_CONTEXT(x) wglewDefaultContext->x + +typedef struct WGLEWContextStruct WGLEWContext; +GLEWAPI GLenum wglewContextInit (WGLEWContext* ctx); + +#define WGLEW_GET_VAR(x) wglewGetContext()->x +#define WGLEW_GET_FUN(x) wglewGetContext()->x + +#else /* GLEW_MX */ + +#define WGLEW_GET_VAR(x) x +#define WGLEW_GET_FUN(x) x + #endif /* GLEW_MX */ -GLEWAPI GLenum wglewContextInit (WGLEWContext* ctx); GLEWAPI GLboolean wglewGetExtension (const char* name); #ifdef __cplusplus } #endif -/* #undef WGLEW_GET_CONTEXT */ #undef GLEWAPI #endif /* __wglew_h__ */