VertexArray stuff and variable order test to sort Linux crash

This commit is contained in:
Mark Watkins 2011-08-02 11:36:03 +10:00
parent 26b2f2cfe6
commit bf4fafb862
5 changed files with 12 additions and 16 deletions

View File

@ -189,18 +189,16 @@ void gFlagsLine::Plot(gGraphWindow & w,float scrx,float scry)
glLineWidth (1.5); glLineWidth (1.5);
} else glLineWidth (1); } else glLineWidth (1);
glEnableClientState(GL_VERTEX_ARRAY);
if (quadcnt>0) { if (quadcnt>0) {
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_SHORT, 0, quadarray); glVertexPointer(2, GL_SHORT, 0, quadarray);
glDrawArrays(GL_QUADS, 0, quadcnt>>1); glDrawArrays(GL_QUADS, 0, quadcnt>>1);
glDisableClientState(GL_VERTEX_ARRAY);
} }
if (vertcnt>0) { if (vertcnt>0) {
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_SHORT, 0, vertarray); glVertexPointer(2, GL_SHORT, 0, vertarray);
glDrawArrays(GL_LINES, 0, vertcnt>>1); glDrawArrays(GL_LINES, 0, vertcnt>>1);
glDisableClientState(GL_VERTEX_ARRAY);
} }
glDisableClientState(GL_VERTEX_ARRAY);
if (antialias) { if (antialias) {
glDisable(GL_LINE_SMOOTH); glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND); glDisable(GL_BLEND);

View File

@ -448,7 +448,6 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_SHORT, 0, vertarray); 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); w.qglColor(m_line_color);
glDrawArrays(GL_LINES, 0, vertcnt>>1); glDrawArrays(GL_LINES, 0, vertcnt>>1);
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);

View File

@ -140,26 +140,26 @@ void gLineOverlayBar::Plot(gGraphWindow & w,float scrx,float scry)
glLineWidth (1.5); glLineWidth (1.5);
} else glLineWidth (1); } else glLineWidth (1);
glEnableClientState(GL_VERTEX_ARRAY);
glColor4ub(col.red(),col.green(),col.blue(),col.alpha()); glColor4ub(col.red(),col.green(),col.blue(),col.alpha());
if (quadcnt>0) { if (quadcnt>0) {
glEnableClientState(GL_VERTEX_ARRAY); //glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_SHORT, 0, quadarray); glVertexPointer(2, GL_SHORT, 0, quadarray);
glDrawArrays(GL_QUADS, 0, quadcnt>>1); glDrawArrays(GL_QUADS, 0, quadcnt>>1);
glDisableClientState(GL_VERTEX_ARRAY); //glDisableClientState(GL_VERTEX_ARRAY);
} }
if (vertcnt>0) { if (vertcnt>0) {
glEnableClientState(GL_VERTEX_ARRAY); //glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_SHORT, 0, vertarray); glVertexPointer(2, GL_SHORT, 0, vertarray);
glDrawArrays(GL_LINES, 0, vertcnt>>1); glDrawArrays(GL_LINES, 0, vertcnt>>1);
glDisableClientState(GL_VERTEX_ARRAY); //glDisableClientState(GL_VERTEX_ARRAY);
} }
if (pointcnt>0) { if (pointcnt>0) {
glPointSize(4); glPointSize(4);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_SHORT, 0, pointarray); glVertexPointer(2, GL_SHORT, 0, pointarray);
glDrawArrays(GL_POINTS, 0, pointcnt>>1); glDrawArrays(GL_POINTS, 0, pointcnt>>1);
glDisableClientState(GL_VERTEX_ARRAY);
} }
glDisableClientState(GL_VERTEX_ARRAY);
if (antialias) { if (antialias) {
glDisable(GL_LINE_SMOOTH); glDisable(GL_LINE_SMOOTH);

View File

@ -37,14 +37,13 @@ public:
virtual bool isEmpty(); virtual bool isEmpty();
inline const ChannelID & code() { return m_code; } inline const ChannelID & code() { return m_code; }
protected: protected:
Day *m_day;
bool m_visible; bool m_visible;
bool m_movable; bool m_movable;
qint64 m_minx,m_maxx; qint64 m_minx,m_maxx;
EventDataType m_miny,m_maxy; EventDataType m_miny,m_maxy;
Day *m_day;
ChannelID m_code;
QString m_title; QString m_title;
ChannelID m_code;
}; };
class gLayerGroup:public gLayer class gLayerGroup:public gLayer

View File

@ -873,10 +873,10 @@ void gGraphWindow::paintGL()
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBegin(GL_QUADS); 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.y());
glVertex2f(m_mouseRBrect.x()+m_mouseRBrect.width(),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.width(),m_mouseRBrect.y()+m_mouseRBrect.height());
glVertex2f(m_mouseRBrect.x(),m_mouseRBrect.y()+m_mouseRBrect.height()); glVertex2f(m_mouseRBrect.x(),m_mouseRBrect.y()+m_mouseRBrect.height());
glEnd(); glEnd();