diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2020-06-02 21:47:06 -0300 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2020-06-02 21:47:06 -0300 |
commit | 113a35d0fe8938973fa1c100b77f456ed250e61b (patch) | |
tree | 586d1c3113082cbb2b92cd46c3c96a25a0e75e67 /Project/Workspace.cpp | |
parent | 6ce2bdcf85dffee6b6ef7b95b888b8b96372a3d6 (diff) | |
download | PSP.git-113a35d0fe8938973fa1c100b77f456ed250e61b.tar.gz PSP.git-113a35d0fe8938973fa1c100b77f456ed250e61b.tar.xz PSP.git-113a35d0fe8938973fa1c100b77f456ed250e61b.zip |
OpenGL bugfixes and wxGC port alternative init
OpenGL major bugfixes;
Device context port alternative to OpenGL code init (WorkspaceDC). Some machines don't support OpenGL 3+;
Fixed some issues with MSVC.
Diffstat (limited to 'Project/Workspace.cpp')
-rw-r--r-- | Project/Workspace.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Project/Workspace.cpp b/Project/Workspace.cpp index 82989b5..9cd1bb6 100644 --- a/Project/Workspace.cpp +++ b/Project/Workspace.cpp @@ -83,13 +83,13 @@ void Workspace::OnPaint(wxPaintEvent& event) if(!m_glCanvas->IsShown()) return; wxPaintDC dc(m_glCanvas); + m_glContext->SetCurrent(*m_glCanvas); SetViewport(); // Set GLCanvas scale and translation. glScaled(m_camera->GetScale(), m_camera->GetScale(), 0.0); // Scale glTranslated(m_camera->GetTranslation().m_x, m_camera->GetTranslation().m_y, 0.0); // Translation - // Draw // Elements @@ -122,6 +122,7 @@ void Workspace::OnPaint(wxPaintEvent& event) glEnd(); glFlush(); // Sends all pending information directly to the GPU. + m_glCanvas->SwapBuffers(); event.Skip(); } @@ -983,7 +984,7 @@ void Workspace::RotateSelectedElements(bool clockwise) void Workspace::DeleteSelectedElements() { // Don't set the end of the list at the loop's begin. - for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) { + for(auto it = m_elementList.begin(); it != m_elementList.end();) { Element* element = *it; if(element->IsSelected()) { @@ -1010,9 +1011,10 @@ void Workspace::DeleteSelectedElements() } } - m_elementList.erase(it--); + it = m_elementList.erase(it); if(element) delete element; } + else it++; } for(auto it = m_textList.begin(); it != m_textList.end(); ++it) { |