Merge pull request #2356 from SpecLad:merge-2.4
This commit is contained in:
@@ -158,7 +158,7 @@ enum {
|
||||
CV_StsVecLengthErr= -28, /* incorrect vector length */
|
||||
CV_StsFilterStructContentErr= -29, /* incorr. filter structure content */
|
||||
CV_StsKernelStructContentErr= -30, /* incorr. transform kernel content */
|
||||
CV_StsFilterOffsetErr= -31, /* incorrect filter ofset value */
|
||||
CV_StsFilterOffsetErr= -31, /* incorrect filter offset value */
|
||||
CV_StsBadSize= -201, /* the input/output structure size is incorrect */
|
||||
CV_StsDivByZero= -202, /* division by zero */
|
||||
CV_StsInplaceNotSupported= -203, /* in-place operation is not supported */
|
||||
|
@@ -44,22 +44,27 @@
|
||||
#include "gl_core_3_1.hpp"
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
#if defined(__APPLE__)
|
||||
#include <mach-o/dyld.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <dlfcn.h>
|
||||
|
||||
static void* AppleGLGetProcAddress (const char* name)
|
||||
{
|
||||
static const struct mach_header* image = 0;
|
||||
if (!image)
|
||||
image = NSAddImage("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", NSADDIMAGE_OPTION_RETURN_ON_ERROR);
|
||||
static bool initialized = false;
|
||||
static void * handle = NULL;
|
||||
if (!handle)
|
||||
{
|
||||
if (!initialized)
|
||||
{
|
||||
initialized = true;
|
||||
const char * const path = "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL";
|
||||
|
||||
// prepend a '_' for the Unix C symbol mangling convention
|
||||
String symbolName = "_";
|
||||
symbolName += String(name);
|
||||
|
||||
NSSymbol symbol = image ? NSLookupSymbolInImage(image, &symbolName[0], NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR) : 0;
|
||||
|
||||
return symbol ? NSAddressOfSymbol(symbol) : 0;
|
||||
handle = dlopen(path, RTLD_LAZY | RTLD_GLOBAL);
|
||||
}
|
||||
if (!handle)
|
||||
return NULL;
|
||||
}
|
||||
return dlsym(handle, name);
|
||||
}
|
||||
#endif // __APPLE__
|
||||
|
||||
|
Reference in New Issue
Block a user