Skip to content

Commit

Permalink
talipot-gui/TlpQtTools: Prevent OpenGL crash with Mesa crocus driver
Browse files Browse the repository at this point in the history
The GL_SELECT rendering mode is buggy with Mesa crocus driver (for legacy
Intel HD Graphics GPUs) when using the LLVM backend so disable it by
setting the DRAW_USE_LLVM environment variable to 0.
  • Loading branch information
anlambert committed Jan 5, 2024
1 parent 5eb361f commit 57a3c9b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions library/talipot-gui/src/TlpQtTools.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* Copyright (C) 2019-2023 The Talipot developers
* Copyright (C) 2019-2024 The Talipot developers
*
* Talipot is a fork of Tulip, created by David Auber
* and the Tulip development Team from LaBRI, University of Bordeaux
Expand Down Expand Up @@ -240,7 +240,7 @@ void initTalipotSoftware(tlp::PluginLoader *loader) {
initQTypeSerializers();
// initialize Texture loader
GlTextureManager::setTextureLoader(new GlTextureFromQImageLoader());
// Load plugins
// load plugins
tlp::PluginLibraryLoader::loadPluginsFromDir(
tlp::TalipotPluginsPath, loader,
QStringToTlpString(tlp::getPluginLocalInstallationDir()) + "/lib/talipot");
Expand All @@ -251,9 +251,16 @@ void initTalipotSoftware(tlp::PluginLoader *loader) {
tlp::GlyphManager::loadGlyphPlugins();
tlp::EdgeExtremityGlyphManager::loadGlyphPlugins();

// Explicitly create a shared OpenGL context to
// ensure it is initialized before using it
GlOffscreenRenderer::instance().getOpenGLContext();
// explicitly create a shared OpenGL context to ensure it is initialized
// before using it
GlOffscreenRenderer::instance().makeOpenGLContextCurrent();
QString glRenderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
if (glRenderer.startsWith("Mesa Intel(R) HD Graphics")) {
// prevent GL_SELECT rendering crash when using the Mesa crocus driver
// for legacy Intel GPUs
qputenv("DRAW_USE_LLVM", "0");
}
GlOffscreenRenderer::instance().doneOpenGLContextCurrent();

const auto &fonts = Font::availableFonts();
for (const auto &itFamily : fonts) {
Expand Down

0 comments on commit 57a3c9b

Please sign in to comment.