summaryrefslogtreecommitdiffstats
path: root/Project/Workspace.cpp
diff options
context:
space:
mode:
authorThales Lima <thaleslima.ufu@gmail.com>2017-10-25 19:17:00 -0200
committerThales Lima <thaleslima.ufu@gmail.com>2017-10-25 19:17:00 -0200
commit7043bf93567689f3b1304cc998c1fb09b7e0e357 (patch)
tree4d6ca5dd407d0f729e7413ddd62d26b25beabfca /Project/Workspace.cpp
parentc53fc819fe6dfe15dc3083b71e0161a68c8b32b5 (diff)
downloadPSP.git-7043bf93567689f3b1304cc998c1fb09b7e0e357.tar.gz
PSP.git-7043bf93567689f3b1304cc998c1fb09b7e0e357.tar.xz
PSP.git-7043bf93567689f3b1304cc998c1fb09b7e0e357.zip
Fixed textures bug on linux
Diffstat (limited to 'Project/Workspace.cpp')
-rw-r--r--Project/Workspace.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/Project/Workspace.cpp b/Project/Workspace.cpp
index 9c491c4..0dc9cc7 100644
--- a/Project/Workspace.cpp
+++ b/Project/Workspace.cpp
@@ -77,6 +77,8 @@ Workspace::~Workspace()
void Workspace::OnPaint(wxPaintEvent& event)
{
+ if(!m_glCanvas->IsShown()) return;
+
wxPaintDC dc(m_glCanvas);
m_glContext->SetCurrent(*m_glCanvas);
SetViewport();
@@ -1151,8 +1153,9 @@ bool Workspace::RunPowerFlow()
return result;
}
-void Workspace::UpdateTextElements()
+bool Workspace::UpdateTextElements()
{
+ bool isTexturesOK = true;
double basePower = m_properties->GetSimulationPropertiesData().basePower;
if(m_properties->GetSimulationPropertiesData().basePowerUnit == UNIT_kVA)
basePower *= 1e3;
@@ -1161,7 +1164,9 @@ void Workspace::UpdateTextElements()
for(auto it = m_textList.begin(), itEnd = m_textList.end(); it != itEnd; ++it) {
Text* text = *it;
text->UpdateText(basePower);
+ if(!text->IsGLTextOK()) isTexturesOK = false;
}
+ return isTexturesOK;
}
void Workspace::CopySelection()
@@ -1395,8 +1400,7 @@ void Workspace::OnIdle(wxIdleEvent& event)
// The OpenGL element (m_glCanvas) must be completely initialized (showed) to draw properly the textures.
// TODO(?): Find other solution to text displayed wrong on opened file.
if(m_justOpened) {
- m_justOpened = false;
- UpdateTextElements();
+ if(UpdateTextElements()) m_justOpened = false;
Redraw();
}
}