From bf4fafb86267e493855eb4d363dd77948745c890 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Tue, 2 Aug 2011 11:36:03 +1000 Subject: [PATCH] VertexArray stuff and variable order test to sort Linux crash --- Graphs/gFlagsLine.cpp | 6 ++---- Graphs/gLineChart.cpp | 1 - Graphs/gLineOverlay.cpp | 12 ++++++------ Graphs/graphlayer.h | 5 ++--- Graphs/graphwindow.cpp | 4 ++-- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Graphs/gFlagsLine.cpp b/Graphs/gFlagsLine.cpp index 5697e194..64316a73 100644 --- a/Graphs/gFlagsLine.cpp +++ b/Graphs/gFlagsLine.cpp @@ -189,18 +189,16 @@ void gFlagsLine::Plot(gGraphWindow & w,float scrx,float scry) glLineWidth (1.5); } else glLineWidth (1); + glEnableClientState(GL_VERTEX_ARRAY); if (quadcnt>0) { - glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_SHORT, 0, quadarray); glDrawArrays(GL_QUADS, 0, quadcnt>>1); - glDisableClientState(GL_VERTEX_ARRAY); } if (vertcnt>0) { - glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_SHORT, 0, vertarray); glDrawArrays(GL_LINES, 0, vertcnt>>1); - glDisableClientState(GL_VERTEX_ARRAY); } + glDisableClientState(GL_VERTEX_ARRAY); if (antialias) { glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); diff --git a/Graphs/gLineChart.cpp b/Graphs/gLineChart.cpp index a30a3729..13b52ce6 100644 --- a/Graphs/gLineChart.cpp +++ b/Graphs/gLineChart.cpp @@ -448,7 +448,6 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry) glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_SHORT, 0, vertarray); - //glColor4ub(m_line_color.red(),m_line_color.green(),m_line_color.blue(),255); w.qglColor(m_line_color); glDrawArrays(GL_LINES, 0, vertcnt>>1); glDisableClientState(GL_VERTEX_ARRAY); diff --git a/Graphs/gLineOverlay.cpp b/Graphs/gLineOverlay.cpp index 2c670915..8a3f957c 100644 --- a/Graphs/gLineOverlay.cpp +++ b/Graphs/gLineOverlay.cpp @@ -140,26 +140,26 @@ void gLineOverlayBar::Plot(gGraphWindow & w,float scrx,float scry) glLineWidth (1.5); } else glLineWidth (1); + glEnableClientState(GL_VERTEX_ARRAY); glColor4ub(col.red(),col.green(),col.blue(),col.alpha()); if (quadcnt>0) { - glEnableClientState(GL_VERTEX_ARRAY); + //glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_SHORT, 0, quadarray); glDrawArrays(GL_QUADS, 0, quadcnt>>1); - glDisableClientState(GL_VERTEX_ARRAY); + //glDisableClientState(GL_VERTEX_ARRAY); } if (vertcnt>0) { - glEnableClientState(GL_VERTEX_ARRAY); + //glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_SHORT, 0, vertarray); glDrawArrays(GL_LINES, 0, vertcnt>>1); - glDisableClientState(GL_VERTEX_ARRAY); + //glDisableClientState(GL_VERTEX_ARRAY); } if (pointcnt>0) { glPointSize(4); - glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_SHORT, 0, pointarray); glDrawArrays(GL_POINTS, 0, pointcnt>>1); - glDisableClientState(GL_VERTEX_ARRAY); } + glDisableClientState(GL_VERTEX_ARRAY); if (antialias) { glDisable(GL_LINE_SMOOTH); diff --git a/Graphs/graphlayer.h b/Graphs/graphlayer.h index 8fe42e95..e882e17b 100644 --- a/Graphs/graphlayer.h +++ b/Graphs/graphlayer.h @@ -37,14 +37,13 @@ public: virtual bool isEmpty(); inline const ChannelID & code() { return m_code; } protected: + Day *m_day; bool m_visible; bool m_movable; - qint64 m_minx,m_maxx; EventDataType m_miny,m_maxy; - Day *m_day; - ChannelID m_code; QString m_title; + ChannelID m_code; }; class gLayerGroup:public gLayer diff --git a/Graphs/graphwindow.cpp b/Graphs/graphwindow.cpp index cc530b7e..85c5145f 100644 --- a/Graphs/graphwindow.cpp +++ b/Graphs/graphwindow.cpp @@ -873,10 +873,10 @@ void gGraphWindow::paintGL() glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBegin(GL_QUADS); - glColor4ub(140,50,200,64); + glColor4ub(140,140,140,64); glVertex2f(m_mouseRBrect.x(),m_mouseRBrect.y()); glVertex2f(m_mouseRBrect.x()+m_mouseRBrect.width(),m_mouseRBrect.y()); - glColor4ub(50,50,200,64); + glColor4ub(50,50,200,128); glVertex2f(m_mouseRBrect.x()+m_mouseRBrect.width(),m_mouseRBrect.y()+m_mouseRBrect.height()); glVertex2f(m_mouseRBrect.x(),m_mouseRBrect.y()+m_mouseRBrect.height()); glEnd();