Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handles failure for not having the correct OpenGL version in windows #904

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions IGraphics/Platforms/IGraphicsWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1140,9 +1140,38 @@ void* IGraphicsWin::OpenWindow(void* pParent)
SetPlatformContext(dc);
ReleaseDC(mPlugWnd, dc);

bool validWindow = true;
#ifdef IGRAPHICS_GL
CreateGLContext();

// check openGl version
const char* ver = (char*)glGetString(GL_VERSION);
int maj = ver[0] - '0';
int min = ver[2] - '0';
int majReq = 2;
int minReq = 1;
std::string msgTitle = "OpenGL 2.1 needed";
std::string msgBody = "Unsupported OpenGL version, this software requires a video adapter supporting at least OpenGL 2.1.\n\nPlease check your video driver.";
#ifdef IGRAPHICS_GL3
majReq = 3;
minReq = 3;
msgTitle = "OpenGL 3.3 needed";
msgBody = "Unsupported OpenGL version, this software requires a video adapter supporting at least OpenGL 3.3.\n\nPlease check your video driver.";
#endif

if(maj < majReq || maj > majReq || (maj == majReq && min < minReq)) {
validWindow = false;
ShowMessageBox(msgBody.c_str(),
msgTitle.c_str(),
EMsgBoxType::kMB_OK,
[](EMsgBoxResult result){});
}
#endif

if(validWindow == false) {
mPlugWnd = nullptr;
return mPlugWnd;
}

OnViewInitialized((void*) dc);

Expand Down
5 changes: 4 additions & 1 deletion IPlug/APP/IPlugAPP_dialog.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,11 @@ WDL_DLGRET IPlugAPPHost::MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA
gHWND = hwndDlg;
IPlugAPP* pPlug = pAppHost->GetPlug();

if (!pAppHost->OpenWindow(gHWND))
if (!pAppHost->OpenWindow(gHWND)) {
DBGMSG("couldn't attach gui\n");
abort();
}


width = pPlug->GetEditorWidth();
height = pPlug->GetEditorHeight();
Expand Down
2 changes: 2 additions & 0 deletions IPlug/VST3/IPlugVST3_View.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ class IPlugVST3View : public Steinberg::CPluginView
else // Carbon
return Steinberg::kResultFalse;
#endif
if(pView == nullptr) return Steinberg::kResultFalse;

return Steinberg::kResultTrue;
}

Expand Down