Skip to content

Commit 8393d75

Browse files
committed
Fixed OpenGL-specific compilation warning (unused function)
1 parent 7474ad8 commit 8393d75

File tree

1 file changed

+31
-42
lines changed

1 file changed

+31
-42
lines changed

modules/core/src/opengl.cpp

Lines changed: 31 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -56,53 +56,42 @@ using namespace cv::cuda;
5656

5757
namespace
5858
{
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_)
6566
{
66-
GLenum err = gl::GetError();
67-
68-
if (err != gl::NO_ERROR_)
67+
const char* msg;
68+
switch (err)
6969
{
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;
10087
}
101-
#endif
102-
103-
#define CV_CheckGlError() CV_DbgAssert( (checkError(__FILE__, __LINE__, CV_Func)) )
88+
return true;
89+
}
90+
#endif // HAVE_OPENGL
10491
} // namespace
10592

93+
#define CV_CheckGlError() CV_DbgAssert( (checkError(__FILE__, __LINE__, CV_Func)) )
94+
10695
#ifdef HAVE_OPENGL
10796
namespace
10897
{

0 commit comments

Comments
 (0)