diff options
author | Thales Lima <thaleslima.ufu@gmail.com> | 2017-10-28 14:30:38 -0200 |
---|---|---|
committer | Thales Lima <thaleslima.ufu@gmail.com> | 2017-10-28 14:30:38 -0200 |
commit | 24808d2de827f219b683ad46744a179ae25bc859 (patch) | |
tree | 4968e6d2403b4fcc1cbcc41502c42e02633dfa83 /Project/MainFrame.cpp | |
parent | 7043bf93567689f3b1304cc998c1fb09b7e0e357 (diff) | |
download | PSP.git-24808d2de827f219b683ad46744a179ae25bc859.tar.gz PSP.git-24808d2de827f219b683ad46744a179ae25bc859.tar.xz PSP.git-24808d2de827f219b683ad46744a179ae25bc859.zip |
Shared OpenGL context bug fixed
Diffstat (limited to 'Project/MainFrame.cpp')
-rw-r--r-- | Project/MainFrame.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Project/MainFrame.cpp b/Project/MainFrame.cpp index 429eabf..2c94a22 100644 --- a/Project/MainFrame.cpp +++ b/Project/MainFrame.cpp @@ -46,7 +46,8 @@ MainFrame::MainFrame(wxWindow* parent, wxLocale* locale, PropertiesData* initPro if(openPath != "") { EnableCurrentProjectRibbon(); - Workspace* newWorkspace = new Workspace(this, _("Open project"), this->GetStatusBar()); + Workspace* newWorkspace = new Workspace(this, _("Open project"), this->GetStatusBar(), m_sharedGLContext); + if(!m_sharedGLContext) m_sharedGLContext = newWorkspace->GetOpenGLContext(); FileHanding fileHandling(newWorkspace); if(fileHandling.OpenProject(openPath)) { @@ -166,7 +167,8 @@ void MainFrame::OnNewClick(wxRibbonButtonBarEvent& event) EnableCurrentProjectRibbon(); Workspace* newWorkspace = - new Workspace(this, wxString::Format(_("New project %d"), m_projectNumber), this->GetStatusBar()); + new Workspace(this, wxString::Format(_("New project %d"), m_projectNumber), this->GetStatusBar(), m_sharedGLContext); + if(!m_sharedGLContext) m_sharedGLContext = newWorkspace->GetOpenGLContext(); m_workspaceList.push_back(newWorkspace); m_ribbonButtonBarContinuous->ToggleButton(ID_RIBBON_DISABLESOL, true); @@ -288,7 +290,8 @@ void MainFrame::OnOpenClick(wxRibbonButtonBarEvent& event) wxFileName fileName(openFileDialog.GetPath()); EnableCurrentProjectRibbon(); - Workspace* newWorkspace = new Workspace(this, _("Open project"), this->GetStatusBar()); + Workspace* newWorkspace = new Workspace(this, _("Open project"), this->GetStatusBar(), m_sharedGLContext); + if(!m_sharedGLContext) m_sharedGLContext = newWorkspace->GetOpenGLContext(); FileHanding fileHandling(newWorkspace); if(fileHandling.OpenProject(fileName)) { @@ -483,11 +486,15 @@ void MainFrame::NotebookPageClosing(wxAuiNotebookEvent& event) auto it = m_workspaceList.begin(); while(it != m_workspaceList.end()) { if(*it == m_auiNotebook->GetCurrentPage()) { + if((*it)->GetOpenGLContext() == m_sharedGLContext) m_sharedGLContext = NULL; m_workspaceList.erase(it); break; } it++; } + if(!m_sharedGLContext && m_workspaceList.size() != 0) { + m_sharedGLContext = m_workspaceList[0]->GetOpenGLContext(); + } event.Skip(); } |