diff --git a/src/slic3r/GUI/3DScene.hpp b/src/slic3r/GUI/3DScene.hpp index 7bd71856d1..01ab2a58a7 100644 --- a/src/slic3r/GUI/3DScene.hpp +++ b/src/slic3r/GUI/3DScene.hpp @@ -11,11 +11,13 @@ #include "GLModel.hpp" #if ENABLE_TEXTURED_VOLUMES #include "GLTexture.hpp" +#include "OpenGLManager.hpp" #endif // ENABLE_TEXTURED_VOLUMES #include #include +#if !ENABLE_TEXTURED_VOLUMES #ifndef NDEBUG #define HAS_GLSAFE #endif // NDEBUG @@ -30,6 +32,7 @@ #define glsafe(cmd) cmd #define glcheck() #endif // HAS_GLSAFE +#endif // !ENABLE_TEXTURED_VOLUMES namespace Slic3r { class SLAPrintObject; diff --git a/src/slic3r/GUI/OpenGLManager.hpp b/src/slic3r/GUI/OpenGLManager.hpp index 72a4e6bc07..c09a0e54f1 100644 --- a/src/slic3r/GUI/OpenGLManager.hpp +++ b/src/slic3r/GUI/OpenGLManager.hpp @@ -3,6 +3,23 @@ #include "GLShadersManager.hpp" +#if ENABLE_TEXTURED_VOLUMES +#ifndef NDEBUG +#define HAS_GLSAFE +#endif // NDEBUG + +#ifdef HAS_GLSAFE +extern void glAssertRecentCallImpl(const char* file_name, unsigned int line, const char* function_name); +inline void glAssertRecentCall() { glAssertRecentCallImpl(__FILE__, __LINE__, __FUNCTION__); } +#define glsafe(cmd) do { cmd; glAssertRecentCallImpl(__FILE__, __LINE__, __FUNCTION__); } while (false) +#define glcheck() do { glAssertRecentCallImpl(__FILE__, __LINE__, __FUNCTION__); } while (false) +#else // HAS_GLSAFE +inline void glAssertRecentCall() { } +#define glsafe(cmd) cmd +#define glcheck() +#endif // HAS_GLSAFE +#endif // ENABLE_TEXTURED_VOLUMES + class wxWindow; class wxGLCanvas; class wxGLContext;