@@ -56,53 +56,42 @@ using namespace cv::cuda;
56
56
57
57
namespace
58
58
{
59
- #ifndef HAVE_OPENGL
60
- inline void throw_no_ogl () { CV_Error (cv::Error::OpenGlNotSupported, " The library is compiled without OpenGL support" ); }
61
- #else
62
- inline void throw_no_ogl () { CV_Error (cv::Error::OpenGlApiCallError, " OpenGL context doesn't exist" ); }
63
-
64
- bool checkError (const char * file, const int line, const char * func = 0 )
59
+ #ifndef HAVE_OPENGL
60
+ inline static void throw_no_ogl () { CV_Error (cv::Error::OpenGlNotSupported, " The library is compiled without OpenGL support" ); }
61
+ #elif defined _DEBUG
62
+ inline static bool checkError (const char * file, const int line, const char * func = 0 )
63
+ {
64
+ GLenum err = gl::GetError ();
65
+ if (err != gl::NO_ERROR_)
65
66
{
66
- GLenum err = gl::GetError ();
67
-
68
- if (err != gl::NO_ERROR_)
67
+ const char * msg;
68
+ switch (err)
69
69
{
70
- const char * msg;
71
-
72
- switch (err)
73
- {
74
- case gl::INVALID_ENUM:
75
- msg = " An unacceptable value is specified for an enumerated argument" ;
76
- break ;
77
-
78
- case gl::INVALID_VALUE:
79
- msg = " A numeric argument is out of range" ;
80
- break ;
81
-
82
- case gl::INVALID_OPERATION:
83
- msg = " The specified operation is not allowed in the current state" ;
84
- break ;
85
-
86
- case gl::OUT_OF_MEMORY:
87
- msg = " There is not enough memory left to execute the command" ;
88
- break ;
89
-
90
- default :
91
- msg = " Unknown error" ;
92
- };
93
-
94
- cvError (CV_OpenGlApiCallError, func, msg, file, line);
95
-
96
- return false ;
97
- }
98
-
99
- return true ;
70
+ case gl::INVALID_ENUM:
71
+ msg = " An unacceptable value is specified for an enumerated argument" ;
72
+ break ;
73
+ case gl::INVALID_VALUE:
74
+ msg = " A numeric argument is out of range" ;
75
+ break ;
76
+ case gl::INVALID_OPERATION:
77
+ msg = " The specified operation is not allowed in the current state" ;
78
+ break ;
79
+ case gl::OUT_OF_MEMORY:
80
+ msg = " There is not enough memory left to execute the command" ;
81
+ break ;
82
+ default :
83
+ msg = " Unknown error" ;
84
+ };
85
+ cvError (CV_OpenGlApiCallError, func, msg, file, line);
86
+ return false ;
100
87
}
101
- # endif
102
-
103
- # define CV_CheckGlError () CV_DbgAssert( (checkError(__FILE__, __LINE__, CV_Func)) )
88
+ return true ;
89
+ }
90
+ # endif // HAVE_OPENGL
104
91
} // namespace
105
92
93
+ #define CV_CheckGlError () CV_DbgAssert( (checkError(__FILE__, __LINE__, CV_Func)) )
94
+
106
95
#ifdef HAVE_OPENGL
107
96
namespace
108
97
{
0 commit comments