From afe556c576e4e906ecf1e2efefa0dc5105c5d118 Mon Sep 17 00:00:00 2001 From: Pascal Thomet Date: Tue, 17 Sep 2024 12:23:50 +0200 Subject: [PATCH] _AssertOpenGlLoaderWorking(): log if OpenGl Loader not ready --- src/immvision/internal/gl/gl_provider.cpp | 7 +++---- src_all_in_one/immvision/immvision.cpp | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/immvision/internal/gl/gl_provider.cpp b/src/immvision/internal/gl/gl_provider.cpp index 2969508..4baf6a5 100644 --- a/src/immvision/internal/gl/gl_provider.cpp +++ b/src/immvision/internal/gl/gl_provider.cpp @@ -24,6 +24,8 @@ namespace ImmVision_GlProvider if ((glGenTexturesAddress == 0) || (glDeleteTexturesAddress == 0)) { #if defined(IMMVISION_USE_GLAD) + fprintf(stderr, "OpenGL Loader was not initialized yet! Trying to initialize it with current OpenGL settings...\n" + "This may fail. If it does, please make sure to call OpenGL functions after the app is initialized.\n"); gladLoadGL(); glGenTexturesAddress = (size_t)glGenTextures; glDeleteTexturesAddress = (size_t)glDeleteTextures; @@ -32,10 +34,7 @@ namespace ImmVision_GlProvider if ((glGenTexturesAddress == 0) || (glDeleteTexturesAddress == 0)) { - const char* err_msg = "glGenTextures/glDeleteTexturesAddress address not initialized. Is your your OpenGL Loader initialized?"; - std::cerr << err_msg; - assert(false); - throw std::runtime_error(err_msg); + IM_ASSERT(false && "OpenGL Loader was not initialized yet!"); } } diff --git a/src_all_in_one/immvision/immvision.cpp b/src_all_in_one/immvision/immvision.cpp index f8255e4..007a35c 100644 --- a/src_all_in_one/immvision/immvision.cpp +++ b/src_all_in_one/immvision/immvision.cpp @@ -7143,6 +7143,8 @@ namespace ImmVision_GlProvider if ((glGenTexturesAddress == 0) || (glDeleteTexturesAddress == 0)) { #if defined(IMMVISION_USE_GLAD) + fprintf(stderr, "OpenGL Loader was not initialized yet! Trying to initialize it with current OpenGL settings...\n" + "This may fail. If it does, please make sure to call OpenGL functions after the app is initialized.\n"); gladLoadGL(); glGenTexturesAddress = (size_t)glGenTextures; glDeleteTexturesAddress = (size_t)glDeleteTextures; @@ -7151,10 +7153,7 @@ namespace ImmVision_GlProvider if ((glGenTexturesAddress == 0) || (glDeleteTexturesAddress == 0)) { - const char* err_msg = "glGenTextures/glDeleteTexturesAddress address not initialized. Is your your OpenGL Loader initialized?"; - std::cerr << err_msg; - assert(false); - throw std::runtime_error(err_msg); + IM_ASSERT(false && "OpenGL Loader was not initialized yet!"); } }