diff options
| author | Bitflash <btf01@proton.me> | 2026-07-28 12:25:01 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-28 12:25:01 -0300 |
| commit | ebb793b0c513e5ee0298228b0185b4bada842513 (patch) | |
| tree | 5606ac093c78e37872755aa91386bfe2f1052090 /src | |
| parent | 8261c39527032485b0e14b4e4a230768218e9b21 (diff) | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/gui.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
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() | |||
| 678 | // --------------------------------------------------------------------------- | 678 | // --------------------------------------------------------------------------- |
| 679 | int RunGUI(int argc, char* argv[]) | 679 | int RunGUI(int argc, char* argv[]) |
| 680 | { | 680 | { |
| 681 | if (!glfwInit()) return 1; | 681 | if (!glfwInit()) { |
| 682 | printf("GUI ERROR: glfwInit() failed -- no display or GL available. Run headless with -nogui.\n"); | ||
| 683 | return 1; | ||
| 684 | } | ||
| 682 | glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); | 685 | glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); |
| 683 | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); | 686 | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); |
| 684 | glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); | 687 | glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); |
| @@ -687,7 +690,13 @@ int RunGUI(int argc, char* argv[]) | |||
| 687 | #endif | 690 | #endif |
| 688 | 691 | ||
| 689 | GLFWwindow* window = glfwCreateWindow(960, 640, "Bitflash", nullptr, nullptr); | 692 | GLFWwindow* window = glfwCreateWindow(960, 640, "Bitflash", nullptr, nullptr); |
| 690 | if (!window) { glfwTerminate(); return 1; } | 693 | if (!window) { |
| 694 | printf("GUI ERROR: could not create an OpenGL 3.3 window.\n"); | ||
| 695 | printf(" Your GPU/driver may not support OpenGL 3.3 core -- common over Remote Desktop, in VMs, or on old GPUs.\n"); | ||
| 696 | printf(" Fixes: update graphics drivers, use a software OpenGL (Mesa), or run headless with -nogui.\n"); | ||
| 697 | glfwTerminate(); | ||
| 698 | return 1; | ||
| 699 | } | ||
| 691 | glfwMakeContextCurrent(window); | 700 | glfwMakeContextCurrent(window); |
| 692 | glfwSwapInterval(1); | 701 | glfwSwapInterval(1); |
| 693 | 702 | ||