Resolve bugs 2237657, 2272725, 2544715, 2237650 and apply patches 2489303, 2320783.

git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@548 783a27ee-832a-0410-bc00-9f386506c6dd
This commit is contained in:
nigels 2009-03-23 18:43:36 +00:00
parent ada95db57b
commit a8ddad81de
6 changed files with 31 additions and 13 deletions

View File

@ -35,9 +35,26 @@
#endif /* GLEW_MX */ #endif /* GLEW_MX */
#if defined(__APPLE__) #if defined(__APPLE__)
#include <mach-o/dyld.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <AvailabilityMacros.h>
#ifdef MAC_OS_X_VERSION_10_3
#include <dlfcn.h>
void* NSGLGetProcAddress (const GLubyte *name)
{
static void* image = NULL;
if (NULL == image)
{
image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
}
return image ? dlsym(image, (const char*)name) : NULL;
}
#else
#include <mach-o/dyld.h>
void* NSGLGetProcAddress (const GLubyte *name) void* NSGLGetProcAddress (const GLubyte *name)
{ {
@ -59,6 +76,7 @@ void* NSGLGetProcAddress (const GLubyte *name)
free(symbolName); free(symbolName);
return symbol ? NSAddressOfSymbol(symbol) : NULL; return symbol ? NSAddressOfSymbol(symbol) : NULL;
} }
#endif /* MAC_OS_X_VERSION_10_3 */
#endif /* __APPLE__ */ #endif /* __APPLE__ */
#if defined(__sgi) || defined (__sun) #if defined(__sgi) || defined (__sun)

View File

@ -28,7 +28,7 @@
/* <windef.h> */ /* <windef.h> */
#ifndef APIENTRY #ifndef APIENTRY
#define GLEW_APIENTRY_DEFINED #define GLEW_APIENTRY_DEFINED
# if defined(__MINGW32__) # if defined(__MINGW32__) || defined(__CYGWIN__)
# define APIENTRY __stdcall # define APIENTRY __stdcall
# elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) # elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__)
# define APIENTRY __stdcall # define APIENTRY __stdcall
@ -37,14 +37,14 @@
# endif # endif
#endif #endif
#ifndef GLAPI #ifndef GLAPI
# if defined(__MINGW32__) # if defined(__MINGW32__) || defined(__CYGWIN__)
# define GLAPI extern # define GLAPI extern
# endif # endif
#endif #endif
/* <winnt.h> */ /* <winnt.h> */
#ifndef CALLBACK #ifndef CALLBACK
#define GLEW_CALLBACK_DEFINED #define GLEW_CALLBACK_DEFINED
# if defined(__MINGW32__) # if defined(__MINGW32__) || defined(__CYGWIN__)
# define CALLBACK __attribute__ ((__stdcall__)) # define CALLBACK __attribute__ ((__stdcall__))
# elif (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) # elif (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
# define CALLBACK __stdcall # define CALLBACK __stdcall
@ -81,7 +81,7 @@ typedef _W64 int ptrdiff_t;
#endif #endif
#ifndef GLAPI #ifndef GLAPI
# if defined(__MINGW32__) # if defined(__MINGW32__) || defined(__CYGWIN__)
# define GLAPI extern # define GLAPI extern
# else # else
# define GLAPI WINGDIAPI # define GLAPI WINGDIAPI
@ -168,7 +168,7 @@ typedef signed long long GLint64EXT;
typedef unsigned long long GLuint64EXT; typedef unsigned long long GLuint64EXT;
# endif # endif
#else #else
# if defined(__MINGW32__) # if defined(__MINGW32__) || defined(__CYGWIN__)
#include <inttypes.h> #include <inttypes.h>
# endif # endif
typedef int64_t GLint64EXT; typedef int64_t GLint64EXT;

View File

@ -4,10 +4,10 @@ GLboolean glxewGetExtension (const char* name)
{ {
GLubyte* p; GLubyte* p;
GLubyte* end; GLubyte* end;
GLuint len = _glewStrLen((const GLubyte*)name); GLuint len;
/* if (glXQueryExtensionsString == NULL || glXGetCurrentDisplay == NULL) return GL_FALSE; */
/* p = (GLubyte*)glXQueryExtensionsString(glXGetCurrentDisplay(), DefaultScreen(glXGetCurrentDisplay())); */ if (glXGetCurrentDisplay == NULL) return GL_FALSE;
if (glXGetClientString == NULL || glXGetCurrentDisplay == NULL) return GL_FALSE; len = _glewStrLen((const GLubyte*)name);
p = (GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS); p = (GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS);
if (0 == p) return GL_FALSE; if (0 == p) return GL_FALSE;
end = p + _glewStrLen(p); end = p + _glewStrLen(p);

View File

@ -199,7 +199,7 @@ GLboolean glewCreateContext ()
aglDestroyPixelFormat(pf); aglDestroyPixelFormat(pf);
/*aglSetDrawable(ctx, GetWindowPort(wnd));*/ /*aglSetDrawable(ctx, GetWindowPort(wnd));*/
octx = aglGetCurrentContext(); octx = aglGetCurrentContext();
if (NULL == aglSetCurrentContext(ctx)) return GL_TRUE; if (GL_FALSE == aglSetCurrentContext(ctx)) return GL_TRUE;
return GL_FALSE; return GL_FALSE;
} }

View File

@ -8,7 +8,7 @@
#define __wglext_h_ #define __wglext_h_
#if !defined(APIENTRY) && !defined(__CYGWIN__) #if !defined(APIENTRY)
# ifndef WIN32_LEAN_AND_MEAN # ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN 1 # define WIN32_LEAN_AND_MEAN 1
# endif # endif

View File

@ -1056,7 +1056,7 @@ GLboolean CreateContext (GLContext* ctx)
aglDestroyPixelFormat(pf); aglDestroyPixelFormat(pf);
/*aglSetDrawable(ctx, GetWindowPort(wnd));*/ /*aglSetDrawable(ctx, GetWindowPort(wnd));*/
ctx->octx = aglGetCurrentContext(); ctx->octx = aglGetCurrentContext();
if (NULL == aglSetCurrentContext(ctx->ctx)) return GL_TRUE; if (GL_FALSE == aglSetCurrentContext(ctx->ctx)) return GL_TRUE;
return GL_FALSE; return GL_FALSE;
} }