Commit ed4926d6 authored by Henrik Zimmer's avatar Henrik Zimmer
Browse files

Bug fix: LineSegment mode when no colors are specified

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@14562 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 9b1def34
......@@ -121,89 +121,105 @@ draw(GLState& /* _state */ , const DrawModes::DrawMode& _drawMode)
// glBegin(GL_LINE_STRIP);
// first check if (new standard) 4-channel colors are specified
if ((line_mode_ == LineSegmentsMode) && (points_.size()/2 == colors4f_.size()) )
if ((line_mode_ == LineSegmentsMode))
{
// enable blending of lines
GLboolean blendb;
glGetBooleanv( GL_BLEND, &blendb);
glEnable(GL_BLEND);
// first check if (new standard) 4-channel colors are specified
if( (points_.size()/2 == colors4f_.size()) )
{
// enable blending of lines
GLboolean blendb;
glGetBooleanv( GL_BLEND, &blendb);
glEnable(GL_BLEND);
// blend func to blend alpha values of lines
GLint sblendfunc;
GLint dblendfunc;
glGetIntegerv( GL_BLEND_SRC_ALPHA, &sblendfunc );
glGetIntegerv( GL_BLEND_DST_ALPHA, &dblendfunc );
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// blend ontop of prev. drawn mesh
GLboolean depthmaskb;
glGetBooleanv( GL_DEPTH_WRITEMASK, &depthmaskb);
glDepthMask(GL_FALSE);
glBegin(GL_LINES);
ConstPointIter p_it=points_.begin(), p_end=points_.end();
ConstColor4fIter c_it=colors4f_.begin();
Color4f c(1.0f,1.0f,1.0f,1.0f);
if(c_it != colors4f_.end()) {
c = *c_it;
}
// blend func to blend alpha values of lines
GLint sblendfunc;
GLint dblendfunc;
glGetIntegerv( GL_BLEND_SRC_ALPHA, &sblendfunc );
glGetIntegerv( GL_BLEND_DST_ALPHA, &dblendfunc );
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
int cnt = 0;
for (; p_it!=p_end; ++p_it)
{
if ((cnt > 0) && (cnt % 2 == 0) && (c_it+1) != colors4f_.end()) {
++c_it;
c = *c_it;
}
// blend ontop of prev. drawn mesh
GLboolean depthmaskb;
glGetBooleanv( GL_DEPTH_WRITEMASK, &depthmaskb);
glDepthMask(GL_FALSE);
glColor(c);
glVertex(*p_it);
glBegin(GL_LINES);
++cnt;
}
ConstPointIter p_it=points_.begin(), p_end=points_.end();
ConstColor4fIter c_it=colors4f_.begin();
glEnd();
// disable blending of lines
if( blendb == GL_FALSE )
glDisable(GL_BLEND);
// reset blend func
glBlendFunc( sblendfunc, dblendfunc );
// enable depth mask
if( depthmaskb == GL_TRUE )
glDepthMask(GL_TRUE);
Color4f c(1.0f,1.0f,1.0f,1.0f);
if(c_it != colors4f_.end()) {
c = *c_it;
}
int cnt = 0;
for (; p_it!=p_end; ++p_it)
else if ((line_mode_ == LineSegmentsMode) && (points_.size()/2 == colors_.size()) )
{
if ((cnt > 0) && (cnt % 2 == 0) && (c_it+1) != colors4f_.end()) {
++c_it;
glBegin(GL_LINES);
ConstPointIter p_it=points_.begin(), p_end=points_.end();
ConstColorIter c_it=colors_.begin();
Color c((char)255, (char)255, (char)255);
if(c_it != colors_.end()) {
c = *c_it;
}
glColor(c);
glVertex(*p_it);
++cnt;
}
glEnd();
// disable blending of lines
if( blendb == GL_FALSE )
glDisable(GL_BLEND);
// reset blend func
glBlendFunc( sblendfunc, dblendfunc );
int cnt = 0;
for (; p_it!=p_end; ++p_it)
{
if ((cnt > 0) && (cnt % 2 == 0) && (c_it+1) != colors_.end()) {
++c_it;
c = *c_it;
}
// enable depth mask
if( depthmaskb == GL_TRUE )
glDepthMask(GL_TRUE);
glColor(c);
glVertex(*p_it);
}
else if ((line_mode_ == LineSegmentsMode) && (points_.size()/2 == colors_.size()) )
{
glBegin(GL_LINES);
ConstPointIter p_it=points_.begin(), p_end=points_.end();
ConstColorIter c_it=colors_.begin();
Color c((char)255, (char)255, (char)255);
if(c_it != colors_.end()) {
c = *c_it;
++cnt;
}
glEnd();
}
int cnt = 0;
for (; p_it!=p_end; ++p_it)
else
{
if ((cnt > 0) && (cnt % 2 == 0) && (c_it+1) != colors_.end()) {
++c_it;
c = *c_it;
glBegin(GL_LINES);
ConstPointIter p_it=points_.begin(), p_end=points_.end();
for (; p_it!=p_end; ++p_it)
{
glVertex(*p_it);
}
glColor(c);
glVertex(*p_it);
++cnt;
glEnd();
}
glEnd();
}
else
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment