Skip to content

Commit 7324367

Browse files
committed
Show error message if openGL3 is not supported instead of crashing
1 parent 8839405 commit 7324367

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Source/NVGSurface.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,18 @@ void NVGSurface::initialise()
137137
nvg = nvgCreateContext(0);
138138
#endif
139139
if (!nvg) {
140-
std::cerr << "could not initialise nvg" << std::endl;
140+
static bool isShowingMessageBox = false;
141+
if (!isShowingMessageBox) {
142+
isShowingMessageBox = true;
143+
std::cerr << "could not initialise nvg" << std::endl;
144+
AlertWindow::showMessageBoxAsync(MessageBoxIconType::WarningIcon,
145+
"Could not initialize plugdata",
146+
"Please check that you have up-to-date graphics drivers installed. At least OpenGL 3.0 support is required to run plugdata.",
147+
"OK",
148+
nullptr,
149+
nullptr);
150+
}
151+
141152
return;
142153
}
143154

@@ -301,6 +312,9 @@ void NVGSurface::render()
301312

302313
if (!nvg) {
303314
initialise();
315+
if (!nvg) {
316+
return;
317+
}
304318
}
305319

306320
if (!makeContextActive()) {

0 commit comments

Comments
 (0)