Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
c6263eb2
Commit
c6263eb2
authored
Dec 07, 2012
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed build with CUDA and witout OpenGL
parent
0d880479
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
40 deletions
+48
-40
gl_core_3_1.cpp
modules/core/src/gl_core_3_1.cpp
+40
-25
opengl_interop.cpp
modules/core/src/opengl_interop.cpp
+8
-15
No files found.
modules/core/src/gl_core_3_1.cpp
View file @
c6263eb2
#include "cvconfig.h"
#ifdef HAVE_OPENGL
#include <string>
#include <sstream>
#include "cvconfig.h"
#include "opencv2/core/core.hpp"
#include "gl_core_3_1.hpp"
#if defined(__APPLE__)
#ifdef HAVE_OPENGL
#if defined(__APPLE__)
#include <mach-o/dyld.h>
static
void
*
AppleGLGetProcAddress
(
const
GLubyte
*
name
)
static
void
*
AppleGLGetProcAddress
(
const
char
*
name
)
{
static
const
struct
mach_header
*
image
=
0
;
if
(
!
image
)
...
...
@@ -16,19 +16,19 @@
// prepend a '_' for the Unix C symbol mangling convention
std
::
string
symbolName
=
"_"
;
symbolName
+=
std
::
string
((
const
char
*
)
name
);
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
;
}
#endif // __APPLE__
#endif // __APPLE__
#if defined(__sgi) || defined (__sun)
#if defined(__sgi) || defined (__sun)
#include <dlfcn.h>
#include <stdio.h>
static
void
*
SunGetProcAddress
(
const
GLubyte
*
name
)
static
void
*
SunGetProcAddress
(
const
char
*
name
)
{
typedef
void
*
(
func_t
*
)(
const
GLubyte
*
);
...
...
@@ -43,11 +43,11 @@
gpa
=
(
func_t
)
dlsym
(
h
,
"glXGetProcAddress"
);
}
return
gpa
?
gpa
(
name
)
:
dlsym
(
h
,
(
const
char
*
)
name
);
return
gpa
?
gpa
((
const
GLubyte
*
)
name
)
:
dlsym
(
h
,
name
);
}
#endif
/* __sgi || __sun */
#endif // __sgi || __sun
#if defined(_WIN32)
#if defined(_WIN32)
#ifdef _MSC_VER
#pragma warning(disable: 4055)
#pragma warning(disable: 4054)
...
...
@@ -75,20 +75,37 @@
HMODULE
glMod
=
GetModuleHandleA
(
"OpenGL32.dll"
);
return
(
PROC
)
GetProcAddress
(
glMod
,
(
LPCSTR
)
name
);
}
#endif // _WIN32
#define IntGetProcAddress(name) WinGetProcAddress(name)
#else
#if defined(__APPLE__)
#define IntGetProcAddress(name) AppleGLGetProcAddress(name)
#else
#if defined(__sgi) || defined(__sun)
#define IntGetProcAddress(name) SunGetProcAddress(name)
#else
/* GLX */
#if defined(_WIN32)
#define CV_GL_GET_PROC_ADDRESS(name) WinGetProcAddress(name)
#elif defined(__APPLE__)
#define CV_GL_GET_PROC_ADDRESS(name) AppleGLGetProcAddress(name)
#elif defined(__sgi) || defined(__sun)
#define CV_GL_GET_PROC_ADDRESS(name) SunGetProcAddress(name)
#else // GLX
#include <GL/glx.h>
#define IntGetProcAddress(name) (*glXGetProcAddressARB)((const GLubyte*) name)
#endif
#define CV_GL_GET_PROC_ADDRESS(name) (*glXGetProcAddressARB)((const GLubyte*) name)
#endif
static
void
*
IntGetProcAddress
(
const
char
*
name
)
{
void
*
func
=
CV_GL_GET_PROC_ADDRESS
(
name
);
if
(
!
func
)
{
std
::
ostringstream
msg
;
msg
<<
"Can't load OpenGL extension ["
<<
name
<<
"]"
;
CV_Error
(
CV_OpenGlApiCallError
,
msg
.
str
());
}
return
func
;
}
#else
static
void
*
IntGetProcAddress
(
const
char
*
)
{
CV_Error
(
CV_OpenGlNotSupported
,
"The library is compiled without OpenGL support"
);
return
0
;
}
#endif
namespace
gl
...
...
@@ -2699,5 +2716,3 @@ namespace gl
InitializeVariables
g_initVariables
;
}
#endif
modules/core/src/opengl_interop.cpp
View file @
c6263eb2
...
...
@@ -44,13 +44,11 @@
#include "opencv2/core/opengl_interop.hpp"
#include "opencv2/core/gpumat.hpp"
#ifdef HAVE_OPENGL
#include "gl_core_3_1.hpp"
#include "gl_core_3_1.hpp"
#ifdef HAVE_CUDA
#ifdef HAVE_CUDA
#include <cuda_runtime.h>
#include <cuda_gl_interop.h>
#endif
#endif
using
namespace
std
;
...
...
@@ -59,6 +57,12 @@ using namespace cv::gpu;
namespace
{
#ifndef HAVE_OPENGL
void
throw_nogl
()
{
CV_Error
(
CV_OpenGlNotSupported
,
"The library is compiled without OpenGL support"
);
}
#else
void
throw_nogl
()
{
CV_Error
(
CV_OpenGlApiCallError
,
"OpenGL context doesn't exist"
);
}
#endif
#ifndef HAVE_CUDA
void
throw_nocuda
()
{
CV_Error
(
CV_GpuNotSupported
,
"The library is compiled without GPU support"
);
}
#else
...
...
@@ -76,12 +80,6 @@ namespace
cv
::
gpu
::
error
(
cudaGetErrorString
(
err
),
file
,
line
,
func
);
}
#endif
#ifndef HAVE_OPENGL
void
throw_nogl
()
{
CV_Error
(
CV_OpenGlNotSupported
,
"The library is compiled without OpenGL support"
);
}
#else
void
throw_nogl
()
{
CV_Error
(
CV_OpenGlApiCallError
,
"OpenGL context doesn't exist"
);
}
#endif
}
bool
cv
::
checkGlError
(
const
char
*
file
,
const
int
line
,
const
char
*
func
)
...
...
@@ -145,12 +143,7 @@ void cv::gpu::setGlDevice(int device)
(
void
)
device
;
throw_nocuda
();
#else
#ifndef HAVE_OPENGL
(
void
)
device
;
throw_nogl
();
#else
cudaSafeCall
(
cudaGLSetGLDevice
(
device
)
);
#endif
#endif
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment