From ebb793b0c513e5ee0298228b0185b4bada842513 Mon Sep 17 00:00:00 2001 From: Bitflash Date: Tue, 28 Jul 2026 12:25:01 -0300 Subject: GUI: print a clear error when OpenGL 3.3 window creation fails (#7) RunGUI() silently returned 1 and the process exited via StopNode() when glfwInit or glfwCreateWindow failed, which reads like a crash. On machines without OpenGL 3.3 core (RDP sessions, VMs, old GPUs) the window never appeared with no explanation. Print an actionable message pointing to driver update / software OpenGL (Mesa) / running headless with -nogui. --- src/gui.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/gui.cpp') diff --git a/src/gui.cpp b/src/gui.cpp index 6d81b9f..2210296 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -678,7 +678,10 @@ static void DrawAboutDialog() // --------------------------------------------------------------------------- int RunGUI(int argc, char* argv[]) { - if (!glfwInit()) return 1; + if (!glfwInit()) { + printf("GUI ERROR: glfwInit() failed -- no display or GL available. Run headless with -nogui.\n"); + return 1; + } glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); @@ -687,7 +690,13 @@ int RunGUI(int argc, char* argv[]) #endif GLFWwindow* window = glfwCreateWindow(960, 640, "Bitflash", nullptr, nullptr); - if (!window) { glfwTerminate(); return 1; } + if (!window) { + printf("GUI ERROR: could not create an OpenGL 3.3 window.\n"); + printf(" Your GPU/driver may not support OpenGL 3.3 core -- common over Remote Desktop, in VMs, or on old GPUs.\n"); + printf(" Fixes: update graphics drivers, use a software OpenGL (Mesa), or run headless with -nogui.\n"); + glfwTerminate(); + return 1; + } glfwMakeContextCurrent(window); glfwSwapInterval(1); -- cgit v1.2.3