Commit a1de9e9a authored by Roman Donchenko's avatar Roman Donchenko Committed by OpenCV Buildbot

Merge pull request #2329 from ilya-lavrenov:macosx_ogl

parents ecbe8430 b92a46c1
......@@ -142,7 +142,7 @@ OCV_OPTION(WITH_IPP "Include Intel IPP support" OFF
OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) )
OCV_OPTION(WITH_JPEG "Include JPEG support" ON)
OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ON IF (NOT IOS) )
OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID AND NOT APPLE) )
OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID) )
OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF IF (NOT ANDROID AND NOT IOS) )
OCV_OPTION(WITH_PNG "Include PNG support" ON)
OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" ON IF (NOT ANDROID AND NOT IOS) )
......
......@@ -47,22 +47,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);
// prepend a '_' for the Unix C symbol mangling convention
std::string symbolName = "_";
symbolName += std::string(name);
NSSymbol symbol = image ? NSLookupSymbolInImage(image, &symbolName[0], NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR) : 0;
return symbol ? NSAddressOfSymbol(symbol) : 0;
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";
handle = dlopen(path, RTLD_LAZY | RTLD_GLOBAL);
}
if (!handle)
return NULL;
}
return dlsym(handle, name);
}
#endif // __APPLE__
......
......@@ -7,6 +7,6 @@ FIND_PACKAGE( OpenCV REQUIRED )
find_package (OpenGL REQUIRED)
ADD_EXECUTABLE(OpenGL_Qt_Binding main.cpp)
ADD_EXECUTABLE(OpenGL_Qt_Binding qt_opengl.cpp)
TARGET_LINK_LIBRARIES(OpenGL_Qt_Binding ${OpenCV_LIBS} ${OPENGL_LIBRARIES} )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cube4.avi ${CMAKE_CURRENT_BINARY_DIR}/cube4.avi COPYONLY)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment