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 */
#if defined(__APPLE__)
#include <mach-o/dyld.h>
#include <stdlib.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)
{
@ -59,6 +76,7 @@ void* NSGLGetProcAddress (const GLubyte *name)
free(symbolName);
return symbol ? NSAddressOfSymbol(symbol) : NULL;
}
#endif /* MAC_OS_X_VERSION_10_3 */
#endif /* __APPLE__ */
#if defined(__sgi) || defined (__sun)

View File

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

View File

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

View File

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

View File

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

View File

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