Skip to content

Commit b09bbfb

Browse files
committed
GridPlot issue fixed
Fixed bug with threaded paint
1 parent 2e1598a commit b09bbfb

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/qwt3d_gridplot.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,8 @@ void GridPlot::createOpenGlData(const Plotlet& pl)
665665
//QElapsedTimer timer;
666666
//timer.start();
667667

668+
m_useThreads = false;
669+
668670
createFloorOpenGlData();
669671

670672
const GridData& data = dynamic_cast<const GridData&>(*pl.data);
@@ -757,6 +759,8 @@ void GridPlot::createOpenGlData(const Plotlet& pl)
757759
}
758760
else // new glDrawArrays-based render
759761
{
762+
m_useThreads = true;
763+
760764
int length = lastrow / m_threadsCount;
761765
int r = 0;
762766

@@ -836,25 +840,28 @@ void GridPlot::createOpenGlData(const Plotlet& pl)
836840

837841

838842
// wait while threads are done
839-
for (int i = 0; i < m_threadsCount; i++)
843+
if (m_useThreads)
840844
{
841-
while (m_workers[i].isRunning());
845+
for (int i = 0; i < m_threadsCount; i++)
846+
{
847+
while (m_workers[i].isRunning());
848+
}
842849
}
843850

844851
//qDebug() << "GridPlot::createOpenGlData(): " << timer.elapsed();
845852
}
846853

847854
void GridPlot::drawOpenGlData()
848855
{
849-
SurfacePlot::drawOpenGlData();
850-
851-
if (m_threadsCount > 0)
856+
if (m_useThreads)
852857
{
853858
for (int i = 0; i < m_threadsCount; i++)
854859
{
855860
m_workers[i].paintGL();
856861
}
857862
}
863+
864+
SurfacePlot::drawOpenGlData();
858865
}
859866

860867
void GridPlot::setRenderThreadsCount(int count)
@@ -884,8 +891,7 @@ void GridPlot::processVertex(const Triple& vert1, const Triple& norm1,
884891

885892
setColorFromVertex(colorData, vert1, lastColor, hl);
886893

887-
if (!m_fastNormals)
888-
glNormal3d(norm1.x, norm1.y, norm1.z);
894+
glNormal3d(norm1.x, norm1.y, norm1.z);
889895

890896
glVertex3d(vert1.x, vert1.y, vert1.z);
891897
}

0 commit comments

Comments
 (0)